@massa-ai/tools-api 1.16.0 → 1.17.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/index.js +1179 -1143
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13109,7 +13109,7 @@ var init_ignore_patterns = __esm(() => {
|
|
|
13109
13109
|
];
|
|
13110
13110
|
});
|
|
13111
13111
|
|
|
13112
|
-
// ../../packages/core/dist/
|
|
13112
|
+
// ../../packages/core/dist/kernel/db-connection.js
|
|
13113
13113
|
import { Pool } from "pg";
|
|
13114
13114
|
function getDbConfig() {
|
|
13115
13115
|
return {
|
|
@@ -13137,7 +13137,7 @@ var init_db_connection = __esm(() => {
|
|
|
13137
13137
|
init_config();
|
|
13138
13138
|
});
|
|
13139
13139
|
|
|
13140
|
-
// ../../packages/core/dist/
|
|
13140
|
+
// ../../packages/core/dist/kernel/alias-resolver.js
|
|
13141
13141
|
class ProjectIdentityAliasResolver {
|
|
13142
13142
|
ttlMs;
|
|
13143
13143
|
resolveTimeoutMs;
|
|
@@ -104662,7 +104662,7 @@ model ManagedRun {
|
|
|
104662
104662
|
Object.assign(exports, Prisma);
|
|
104663
104663
|
});
|
|
104664
104664
|
|
|
104665
|
-
// ../../packages/core/dist/
|
|
104665
|
+
// ../../packages/core/dist/kernel/prisma-client.js
|
|
104666
104666
|
var exports_prisma_client = {};
|
|
104667
104667
|
__export(exports_prisma_client, {
|
|
104668
104668
|
getPrismaClient: () => getPrismaClient2,
|
|
@@ -105473,7 +105473,7 @@ var init_query_understanding = __esm(() => {
|
|
|
105473
105473
|
HYDE_SYSTEM = "You write a hypothetical implementation paragraph that a code-knowledge " + "search system will embed and match against real documents. Write ONE " + "concise paragraph (3-6 sentences) of plausible implementation detail " + "(types, function signatures, control flow) that a relevant document would " + "contain. No preamble, no markdown.";
|
|
105474
105474
|
});
|
|
105475
105475
|
|
|
105476
|
-
// ../../packages/core/dist/
|
|
105476
|
+
// ../../packages/core/dist/kernel/types.js
|
|
105477
105477
|
var STRUCTURAL_TAXONOMY_VERSION = "1.0.0", SOURCE_SPAN_SCHEMA_VERSION = "1.0.0", STRUCTURAL_FQN_SCHEMA_VERSION = "1.0.0";
|
|
105478
105478
|
var init_types3 = __esm(() => {
|
|
105479
105479
|
init_dist();
|
|
@@ -106565,7 +106565,7 @@ answer = 42
|
|
|
106565
106565
|
});
|
|
106566
106566
|
});
|
|
106567
106567
|
|
|
106568
|
-
// ../../packages/core/dist/
|
|
106568
|
+
// ../../packages/core/dist/kernel/registry.js
|
|
106569
106569
|
function directStorePolicy(tableName, columnName) {
|
|
106570
106570
|
if (/^vector_documents(?:_\d+d)?$/.test(tableName) && columnName === "project_id") {
|
|
106571
106571
|
return { storeId: tableName, identityColumn: columnName, mutable: true };
|
|
@@ -106626,7 +106626,7 @@ var init_registry = __esm(() => {
|
|
|
106626
106626
|
];
|
|
106627
106627
|
});
|
|
106628
106628
|
|
|
106629
|
-
// ../../packages/core/dist/
|
|
106629
|
+
// ../../packages/core/dist/kernel/identity-guard-installer.js
|
|
106630
106630
|
async function installGuardOnTable(client, schema, table, column) {
|
|
106631
106631
|
try {
|
|
106632
106632
|
await client.query(`SELECT project_identity_install_guard($1::regclass, $2)`, [`${schema}.${table}`, column]);
|
|
@@ -106691,7 +106691,7 @@ var init_identity_guard_installer = __esm(() => {
|
|
|
106691
106691
|
init_registry();
|
|
106692
106692
|
});
|
|
106693
106693
|
|
|
106694
|
-
// ../../packages/core/dist/
|
|
106694
|
+
// ../../packages/core/dist/kernel/lexical-search.js
|
|
106695
106695
|
function dedupeTokens(tokens) {
|
|
106696
106696
|
const seen = new Set;
|
|
106697
106697
|
const out = [];
|
|
@@ -107355,9 +107355,16 @@ var init_keyword_search_factory = __esm(() => {
|
|
|
107355
107355
|
// ../../packages/core/dist/data/vector/base-vector-store.js
|
|
107356
107356
|
class BaseVectorStore {
|
|
107357
107357
|
embeddingProviderPromise = null;
|
|
107358
|
+
embeddingProviderFactory;
|
|
107359
|
+
constructor(options) {
|
|
107360
|
+
this.embeddingProviderFactory = options?.embeddingProviderFactory;
|
|
107361
|
+
}
|
|
107358
107362
|
getEmbeddingProvider() {
|
|
107359
107363
|
if (!this.embeddingProviderPromise) {
|
|
107360
|
-
this.
|
|
107364
|
+
if (!this.embeddingProviderFactory) {
|
|
107365
|
+
throw new Error("BaseVectorStore: no embeddingProviderFactory was supplied. Construct this store " + "via services/vector/vector-store-factory.ts (getVectorStore), or pass an explicit " + "embeddingProviderFactory to the constructor.");
|
|
107366
|
+
}
|
|
107367
|
+
this.embeddingProviderPromise = this.embeddingProviderFactory();
|
|
107361
107368
|
}
|
|
107362
107369
|
return this.embeddingProviderPromise;
|
|
107363
107370
|
}
|
|
@@ -107403,7 +107410,6 @@ class BaseVectorStore {
|
|
|
107403
107410
|
}
|
|
107404
107411
|
}
|
|
107405
107412
|
var init_base_vector_store = __esm(() => {
|
|
107406
|
-
init_embeddings();
|
|
107407
107413
|
init_dist();
|
|
107408
107414
|
});
|
|
107409
107415
|
|
|
@@ -107529,7 +107535,7 @@ var init_postgres_vector_store = __esm(() => {
|
|
|
107529
107535
|
tableName = "vector_documents";
|
|
107530
107536
|
bqEnabled = false;
|
|
107531
107537
|
constructor(config3) {
|
|
107532
|
-
super();
|
|
107538
|
+
super(config3.embeddingProviderFactory ? { embeddingProviderFactory: config3.embeddingProviderFactory } : undefined);
|
|
107533
107539
|
this.config = {
|
|
107534
107540
|
poolSize: 10,
|
|
107535
107541
|
indexType: "hnsw",
|
|
@@ -107985,7 +107991,7 @@ var init_postgres_vector_store = __esm(() => {
|
|
|
107985
107991
|
};
|
|
107986
107992
|
});
|
|
107987
107993
|
|
|
107988
|
-
// ../../packages/core/dist/
|
|
107994
|
+
// ../../packages/core/dist/services/vector/vector-store-factory.js
|
|
107989
107995
|
async function getVectorStore(config3) {
|
|
107990
107996
|
if (cachedStore)
|
|
107991
107997
|
return cachedStore;
|
|
@@ -108002,6 +108008,7 @@ async function getVectorStore(config3) {
|
|
|
108002
108008
|
...ivfflatLists ? { lists: ivfflatLists } : {}
|
|
108003
108009
|
};
|
|
108004
108010
|
const store = new PostgresVectorStore({
|
|
108011
|
+
embeddingProviderFactory: () => createEmbeddingProvider({ cache: true }),
|
|
108005
108012
|
connectionString,
|
|
108006
108013
|
poolSize: Number.parseInt(process.env.POSTGRES_VECTOR_POOL_SIZE || "10", 10),
|
|
108007
108014
|
indexType: process.env.POSTGRES_VECTOR_INDEX || "hnsw",
|
|
@@ -108028,6 +108035,7 @@ var init_vector_store_factory = __esm(() => {
|
|
|
108028
108035
|
init_dist();
|
|
108029
108036
|
init_config();
|
|
108030
108037
|
init_postgres_vector_store();
|
|
108038
|
+
init_embeddings();
|
|
108031
108039
|
});
|
|
108032
108040
|
|
|
108033
108041
|
// ../../packages/core/dist/services/search/search-cache-pg.js
|
|
@@ -108599,7 +108607,7 @@ var init_analytics_factory = __esm(() => {
|
|
|
108599
108607
|
init_dist();
|
|
108600
108608
|
});
|
|
108601
108609
|
|
|
108602
|
-
// ../../packages/core/dist/
|
|
108610
|
+
// ../../packages/core/dist/kernel/schema-version.js
|
|
108603
108611
|
function parseSemver(version3) {
|
|
108604
108612
|
const match2 = SEMVER_PATTERN.exec(version3.trim());
|
|
108605
108613
|
if (!match2)
|
|
@@ -108638,7 +108646,7 @@ var init_schema_version = __esm(() => {
|
|
|
108638
108646
|
SEMVER_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/u;
|
|
108639
108647
|
});
|
|
108640
108648
|
|
|
108641
|
-
// ../../packages/core/dist/
|
|
108649
|
+
// ../../packages/core/dist/kernel/fqn-codec.js
|
|
108642
108650
|
import { createHash as createHash3 } from "crypto";
|
|
108643
108651
|
function normalizedNfcText(value, label) {
|
|
108644
108652
|
const normalized = value.normalize("NFC").trim();
|
|
@@ -112877,7 +112885,7 @@ var init_reranker = __esm(() => {
|
|
|
112877
112885
|
});
|
|
112878
112886
|
});
|
|
112879
112887
|
|
|
112880
|
-
// ../../packages/core/dist/
|
|
112888
|
+
// ../../packages/core/dist/kernel/enum-validation.js
|
|
112881
112889
|
function validateEnum(paramName, value, validValues) {
|
|
112882
112890
|
if (typeof value !== "string" || !validValues.includes(value)) {
|
|
112883
112891
|
throw new ToolError(`Invalid ${paramName} value: ${String(value)}. Valid values: ${validValues.join(", ")}.`);
|
|
@@ -112949,7 +112957,7 @@ var init_filter_validation = __esm(() => {
|
|
|
112949
112957
|
init_enum_validation();
|
|
112950
112958
|
});
|
|
112951
112959
|
|
|
112952
|
-
// ../../packages/core/dist/
|
|
112960
|
+
// ../../packages/core/dist/services/search/search-controller.js
|
|
112953
112961
|
var exports_search_controller = {};
|
|
112954
112962
|
__export(exports_search_controller, {
|
|
112955
112963
|
SearchController: () => SearchController
|
|
@@ -113694,7 +113702,7 @@ var init_session_bias = __esm(() => {
|
|
|
113694
113702
|
init_synapse();
|
|
113695
113703
|
});
|
|
113696
113704
|
|
|
113697
|
-
// ../../packages/core/dist/
|
|
113705
|
+
// ../../packages/core/dist/kernel/search-diagnostics.js
|
|
113698
113706
|
function searchBackendUnavailable(component, cause) {
|
|
113699
113707
|
return cause instanceof SearchServiceError ? cause : new SearchServiceError("SEARCH_BACKEND_UNAVAILABLE", component, { cause });
|
|
113700
113708
|
}
|
|
@@ -124146,7 +124154,7 @@ var init_salience_judge = __esm(() => {
|
|
|
124146
124154
|
});
|
|
124147
124155
|
});
|
|
124148
124156
|
|
|
124149
|
-
// ../../packages/core/dist/
|
|
124157
|
+
// ../../packages/core/dist/services/memory/memory-controller.js
|
|
124150
124158
|
class MemoryController {
|
|
124151
124159
|
static instance = null;
|
|
124152
124160
|
repo;
|
|
@@ -124783,6 +124791,45 @@ var init_code_compressor = __esm(() => {
|
|
|
124783
124791
|
init_llm_client();
|
|
124784
124792
|
});
|
|
124785
124793
|
|
|
124794
|
+
// ../../packages/core/dist/services/compression/compress-with-metrics.js
|
|
124795
|
+
async function compressWithMetrics(compressor, content, strategy, options = {}) {
|
|
124796
|
+
const { language, targetRatio } = options;
|
|
124797
|
+
const unit = language || "code";
|
|
124798
|
+
const originalTokens = estimateTokens(content, unit);
|
|
124799
|
+
logger.info("Compressing context", {
|
|
124800
|
+
originalTokens,
|
|
124801
|
+
strategy,
|
|
124802
|
+
targetRatio
|
|
124803
|
+
});
|
|
124804
|
+
const result = await compressor.compress(content, strategy);
|
|
124805
|
+
const compressedTokens = estimateTokens(result.compressed, unit);
|
|
124806
|
+
const compressionRatio = 1 - compressedTokens / originalTokens;
|
|
124807
|
+
const tokensSaved = originalTokens - compressedTokens;
|
|
124808
|
+
logger.info("Context compressed", {
|
|
124809
|
+
originalTokens,
|
|
124810
|
+
compressedTokens,
|
|
124811
|
+
tokensSaved,
|
|
124812
|
+
actualRatio: compressionRatio.toFixed(2),
|
|
124813
|
+
targetRatio
|
|
124814
|
+
});
|
|
124815
|
+
return {
|
|
124816
|
+
compressed: result.compressed,
|
|
124817
|
+
originalTokens,
|
|
124818
|
+
compressedTokens,
|
|
124819
|
+
tokensSaved,
|
|
124820
|
+
compressionRatio
|
|
124821
|
+
};
|
|
124822
|
+
}
|
|
124823
|
+
var init_compress_with_metrics = __esm(() => {
|
|
124824
|
+
init_dist();
|
|
124825
|
+
});
|
|
124826
|
+
|
|
124827
|
+
// ../../packages/core/dist/services/compression/index.js
|
|
124828
|
+
var init_compression = __esm(() => {
|
|
124829
|
+
init_code_compressor();
|
|
124830
|
+
init_compress_with_metrics();
|
|
124831
|
+
});
|
|
124832
|
+
|
|
124786
124833
|
// ../../packages/core/dist/services/metrics/token-metrics.js
|
|
124787
124834
|
class TokenMetrics {
|
|
124788
124835
|
static instance = null;
|
|
@@ -125116,6 +125163,340 @@ var init_session_file_cache = __esm(() => {
|
|
|
125116
125163
|
SESSION_TTL_MS = 4 * 60 * 60 * 1000;
|
|
125117
125164
|
});
|
|
125118
125165
|
|
|
125166
|
+
// ../../packages/core/dist/services/context/context-controller.js
|
|
125167
|
+
class ContextController {
|
|
125168
|
+
static instance = null;
|
|
125169
|
+
searchCtrl;
|
|
125170
|
+
memoryCtrl;
|
|
125171
|
+
compressor;
|
|
125172
|
+
sessionCache;
|
|
125173
|
+
constructor() {
|
|
125174
|
+
this.searchCtrl = SearchController.getInstance();
|
|
125175
|
+
this.memoryCtrl = MemoryController.getInstance();
|
|
125176
|
+
this.compressor = new CodeCompressor;
|
|
125177
|
+
this.sessionCache = SessionFileCache.getInstance();
|
|
125178
|
+
}
|
|
125179
|
+
static getInstance() {
|
|
125180
|
+
if (!ContextController.instance) {
|
|
125181
|
+
ContextController.instance = new ContextController;
|
|
125182
|
+
}
|
|
125183
|
+
return ContextController.instance;
|
|
125184
|
+
}
|
|
125185
|
+
async getOptimizedContext(input) {
|
|
125186
|
+
const { query, projectId, projectPath: projectPath2, maxTokens = 4000, maxResults = 5, workingMemoryBudget, userId, sessionId, includeMemories = true, memoryBudgetRatio = 0.2 } = input;
|
|
125187
|
+
const clampedRatio = Math.max(0, Math.min(0.5, memoryBudgetRatio));
|
|
125188
|
+
const memoryTokenBudget = includeMemories ? Math.floor(maxTokens * clampedRatio) : 0;
|
|
125189
|
+
const codeTokenBudget = maxTokens - memoryTokenBudget;
|
|
125190
|
+
const wmBudget = workingMemoryBudget || Math.floor(codeTokenBudget * 0.8);
|
|
125191
|
+
logger.info("Getting optimized context", {
|
|
125192
|
+
query: query.slice(0, 50),
|
|
125193
|
+
projectId,
|
|
125194
|
+
maxTokens,
|
|
125195
|
+
includeMemories,
|
|
125196
|
+
memoryTokenBudget,
|
|
125197
|
+
codeTokenBudget,
|
|
125198
|
+
workingMemoryBudget: wmBudget
|
|
125199
|
+
});
|
|
125200
|
+
let graphContextSection = "";
|
|
125201
|
+
let graphBoostFiles = [];
|
|
125202
|
+
if (projectId && await symbolGraphService.hasData(projectId) && looksLikeSymbol(query)) {
|
|
125203
|
+
try {
|
|
125204
|
+
const [defs, refs] = await Promise.all([
|
|
125205
|
+
symbolGraphService.goToDefinition(projectId, query),
|
|
125206
|
+
symbolGraphService.getReferences(projectId, query)
|
|
125207
|
+
]);
|
|
125208
|
+
if (defs.length > 0) {
|
|
125209
|
+
const graphTokenBudget = Math.floor(codeTokenBudget * 0.2);
|
|
125210
|
+
graphContextSection = formatGraphContext(defs, refs, graphTokenBudget);
|
|
125211
|
+
graphBoostFiles = [
|
|
125212
|
+
...new Set([
|
|
125213
|
+
...defs.map((d) => d.file),
|
|
125214
|
+
...refs.slice(0, 10).map((r2) => r2.fromFile)
|
|
125215
|
+
])
|
|
125216
|
+
];
|
|
125217
|
+
logger.debug("Graph prefilter hit", {
|
|
125218
|
+
query,
|
|
125219
|
+
defs: defs.length,
|
|
125220
|
+
refs: refs.length,
|
|
125221
|
+
boostFiles: graphBoostFiles.length
|
|
125222
|
+
});
|
|
125223
|
+
}
|
|
125224
|
+
} catch (err) {
|
|
125225
|
+
logger.warn("Graph prefilter failed", { query, error: err.message });
|
|
125226
|
+
}
|
|
125227
|
+
}
|
|
125228
|
+
const [searchResult, memories] = await Promise.all([
|
|
125229
|
+
this.searchCtrl.searchProject({
|
|
125230
|
+
query,
|
|
125231
|
+
projectId,
|
|
125232
|
+
projectPath: projectPath2,
|
|
125233
|
+
maxResults,
|
|
125234
|
+
responseMode: "full",
|
|
125235
|
+
autoReindex: false,
|
|
125236
|
+
minScore: 0.4,
|
|
125237
|
+
boostFiles: graphBoostFiles.length > 0 ? graphBoostFiles : undefined
|
|
125238
|
+
}),
|
|
125239
|
+
includeMemories ? this.searchMemoriesSafe(query, {
|
|
125240
|
+
projectId,
|
|
125241
|
+
userId,
|
|
125242
|
+
sessionId,
|
|
125243
|
+
limit: 5
|
|
125244
|
+
}) : Promise.resolve([])
|
|
125245
|
+
]);
|
|
125246
|
+
const codeResults = searchResult.results;
|
|
125247
|
+
const workingSet = this.selectWorkingSet(codeResults, wmBudget);
|
|
125248
|
+
const memorySection = this.formatMemorySection(memories, memoryTokenBudget);
|
|
125249
|
+
if (workingSet.length === 0 && memories.length === 0) {
|
|
125250
|
+
return {
|
|
125251
|
+
context: `No relevant code or memories found for query: "${query}"`,
|
|
125252
|
+
sources: [],
|
|
125253
|
+
resultsCount: 0,
|
|
125254
|
+
memoriesCount: 0,
|
|
125255
|
+
tokensSaved: 0,
|
|
125256
|
+
compressionRatio: 0,
|
|
125257
|
+
sessionCacheHits: 0,
|
|
125258
|
+
tokensSavedBySessionCache: 0
|
|
125259
|
+
};
|
|
125260
|
+
}
|
|
125261
|
+
let sessionCacheHits = 0;
|
|
125262
|
+
let tokensSavedBySessionCache = 0;
|
|
125263
|
+
const deliveryPlan = workingSet.map((r2) => {
|
|
125264
|
+
if (!sessionId) {
|
|
125265
|
+
return { result: r2, kind: "full", tokensSaved: 0 };
|
|
125266
|
+
}
|
|
125267
|
+
const content = r2.content || r2.preview || "";
|
|
125268
|
+
const key = this.sessionCache.chunkKey(r2.filePath || "unknown", r2.lineStart ?? 0, r2.lineEnd ?? 0);
|
|
125269
|
+
const check3 = this.sessionCache.check(sessionId, key, content);
|
|
125270
|
+
if (check3.status === "unchanged") {
|
|
125271
|
+
sessionCacheHits++;
|
|
125272
|
+
tokensSavedBySessionCache += check3.tokensSaved;
|
|
125273
|
+
return { result: r2, kind: "ref", tokensSaved: check3.tokensSaved };
|
|
125274
|
+
}
|
|
125275
|
+
if (check3.status === "changed" && check3.diff !== undefined) {
|
|
125276
|
+
sessionCacheHits++;
|
|
125277
|
+
tokensSavedBySessionCache += check3.tokensSaved;
|
|
125278
|
+
return { result: r2, kind: "diff", diff: check3.diff, tokensSaved: check3.tokensSaved };
|
|
125279
|
+
}
|
|
125280
|
+
return { result: r2, kind: "full", tokensSaved: 0 };
|
|
125281
|
+
});
|
|
125282
|
+
const parts = [`# Context for: ${query}
|
|
125283
|
+
`];
|
|
125284
|
+
if (graphContextSection) {
|
|
125285
|
+
parts.push(graphContextSection, "");
|
|
125286
|
+
}
|
|
125287
|
+
if (memorySection) {
|
|
125288
|
+
parts.push(memorySection, "");
|
|
125289
|
+
}
|
|
125290
|
+
if (deliveryPlan.length > 0) {
|
|
125291
|
+
const fullCount = deliveryPlan.filter((d) => d.kind === "full").length;
|
|
125292
|
+
const refCount = deliveryPlan.filter((d) => d.kind === "ref").length;
|
|
125293
|
+
const diffCount = deliveryPlan.filter((d) => d.kind === "diff").length;
|
|
125294
|
+
parts.push(`## Code (${deliveryPlan.length} sections \u2014 ${fullCount} full, ${refCount} cached, ${diffCount} diff | WM budget: ${wmBudget} tokens)
|
|
125295
|
+
`);
|
|
125296
|
+
deliveryPlan.forEach(({ result: r2, kind, diff }, idx) => {
|
|
125297
|
+
const filePath = r2.filePath || "Unknown";
|
|
125298
|
+
const scoreLabel = (r2.score * 100).toFixed(1);
|
|
125299
|
+
const lineRange = `${r2.lineStart ?? "?"}-${r2.lineEnd ?? "?"}`;
|
|
125300
|
+
parts.push(`### ${idx + 1}. ${filePath} (score: ${scoreLabel}%)`);
|
|
125301
|
+
parts.push(`Lines ${lineRange}
|
|
125302
|
+
`);
|
|
125303
|
+
if (kind === "ref") {
|
|
125304
|
+
parts.push(`[CACHED: ${filePath}:${lineRange}]
|
|
125305
|
+
`);
|
|
125306
|
+
} else if (kind === "diff" && diff) {
|
|
125307
|
+
parts.push("```diff");
|
|
125308
|
+
parts.push(diff);
|
|
125309
|
+
parts.push("```\n");
|
|
125310
|
+
} else {
|
|
125311
|
+
parts.push("```" + (r2.language || ""));
|
|
125312
|
+
parts.push(r2.content || r2.preview || "(no content)");
|
|
125313
|
+
parts.push("```\n");
|
|
125314
|
+
}
|
|
125315
|
+
});
|
|
125316
|
+
}
|
|
125317
|
+
const rawContext = parts.join(`
|
|
125318
|
+
`);
|
|
125319
|
+
const rawTokens = estimateTokens(rawContext, "code");
|
|
125320
|
+
let finalContext = rawContext;
|
|
125321
|
+
let compressionRatio = 0;
|
|
125322
|
+
let tokensSaved = 0;
|
|
125323
|
+
if (rawTokens > maxTokens) {
|
|
125324
|
+
logger.info("Context exceeds maxTokens, compressing", {
|
|
125325
|
+
rawTokens,
|
|
125326
|
+
maxTokens
|
|
125327
|
+
});
|
|
125328
|
+
try {
|
|
125329
|
+
const metrics2 = await compressWithMetrics(this.compressor, rawContext, "code_structure", { targetRatio: 0.6 });
|
|
125330
|
+
finalContext = metrics2.compressed;
|
|
125331
|
+
compressionRatio = metrics2.compressionRatio || 0;
|
|
125332
|
+
tokensSaved = metrics2.tokensSaved || 0;
|
|
125333
|
+
} catch (error51) {
|
|
125334
|
+
logger.error("Failed to compress context", error51, {
|
|
125335
|
+
strategy: "code_structure",
|
|
125336
|
+
contentLength: rawContext.length
|
|
125337
|
+
});
|
|
125338
|
+
}
|
|
125339
|
+
}
|
|
125340
|
+
const finalTokens = estimateTokens(finalContext, "code");
|
|
125341
|
+
const totalTokensSaved = rawTokens - finalTokens;
|
|
125342
|
+
const compressionSavings = tokensSaved;
|
|
125343
|
+
TokenMetrics.getInstance().recordContextRequest(rawTokens, finalTokens, tokensSavedBySessionCache, compressionSavings);
|
|
125344
|
+
logger.info("Optimized context retrieved", {
|
|
125345
|
+
rawTokens,
|
|
125346
|
+
finalTokens,
|
|
125347
|
+
tokensSaved: totalTokensSaved,
|
|
125348
|
+
compressionRatio,
|
|
125349
|
+
codeSources: workingSet.length,
|
|
125350
|
+
memoriesIncluded: memories.length,
|
|
125351
|
+
wmBudget,
|
|
125352
|
+
sessionCacheHits,
|
|
125353
|
+
tokensSavedBySessionCache
|
|
125354
|
+
});
|
|
125355
|
+
return {
|
|
125356
|
+
context: finalContext,
|
|
125357
|
+
sources: workingSet.map((r2) => r2.filePath || "unknown"),
|
|
125358
|
+
resultsCount: workingSet.length,
|
|
125359
|
+
memoriesCount: memories.length,
|
|
125360
|
+
tokensSaved: totalTokensSaved,
|
|
125361
|
+
compressionRatio,
|
|
125362
|
+
sessionCacheHits,
|
|
125363
|
+
tokensSavedBySessionCache
|
|
125364
|
+
};
|
|
125365
|
+
}
|
|
125366
|
+
async searchMemoriesSafe(query, opts) {
|
|
125367
|
+
try {
|
|
125368
|
+
const result = await this.memoryCtrl.search({
|
|
125369
|
+
query,
|
|
125370
|
+
projectId: opts.projectId,
|
|
125371
|
+
userId: opts.userId,
|
|
125372
|
+
sessionId: opts.sessionId,
|
|
125373
|
+
includePersistent: true,
|
|
125374
|
+
minImportance: 0.3,
|
|
125375
|
+
limit: opts.limit
|
|
125376
|
+
});
|
|
125377
|
+
return result.memories;
|
|
125378
|
+
} catch (error51) {
|
|
125379
|
+
logger.warn("Memory search failed, continuing without memories", {
|
|
125380
|
+
error: error51.message,
|
|
125381
|
+
query: query.slice(0, 30)
|
|
125382
|
+
});
|
|
125383
|
+
return [];
|
|
125384
|
+
}
|
|
125385
|
+
}
|
|
125386
|
+
formatMemorySection(memories, tokenBudget) {
|
|
125387
|
+
if (memories.length === 0 || tokenBudget <= 0)
|
|
125388
|
+
return null;
|
|
125389
|
+
const parts = [
|
|
125390
|
+
`## Relevant Memories (from previous sessions)
|
|
125391
|
+
`
|
|
125392
|
+
];
|
|
125393
|
+
let usedTokens = estimateTokens(parts[0], "text");
|
|
125394
|
+
for (const memory of memories) {
|
|
125395
|
+
const typeLabel = (memory.type || "unknown").toUpperCase();
|
|
125396
|
+
const score = memory.score ? ` (relevance: ${(memory.score * 100).toFixed(0)}%)` : "";
|
|
125397
|
+
const importance = memory.importance ? ` [importance: ${(memory.importance * 100).toFixed(0)}%]` : "";
|
|
125398
|
+
const agent = memory.agentId ? ` (by: ${memory.agentId})` : "";
|
|
125399
|
+
const entry2 = `- **[${typeLabel}]**${score}${importance}${agent}: ${memory.content}`;
|
|
125400
|
+
const entryTokens = estimateTokens(entry2, "text");
|
|
125401
|
+
if (usedTokens + entryTokens > tokenBudget)
|
|
125402
|
+
break;
|
|
125403
|
+
parts.push(entry2);
|
|
125404
|
+
usedTokens += entryTokens;
|
|
125405
|
+
}
|
|
125406
|
+
return parts.length <= 1 ? null : parts.join(`
|
|
125407
|
+
`);
|
|
125408
|
+
}
|
|
125409
|
+
selectWorkingSet(results, tokenBudget) {
|
|
125410
|
+
if (!results.length || tokenBudget <= 0)
|
|
125411
|
+
return [];
|
|
125412
|
+
const selected = [];
|
|
125413
|
+
const selectedFiles = new Set;
|
|
125414
|
+
let usedTokens = 0;
|
|
125415
|
+
const sorted = [...results].sort((a12, b) => (b.score || 0) - (a12.score || 0));
|
|
125416
|
+
for (const result of sorted) {
|
|
125417
|
+
const filePath = result.filePath || "unknown";
|
|
125418
|
+
if (selectedFiles.has(filePath))
|
|
125419
|
+
continue;
|
|
125420
|
+
const content = result.content || result.preview || "";
|
|
125421
|
+
const tokens = estimateTokens(content, "code");
|
|
125422
|
+
if (usedTokens + tokens > tokenBudget)
|
|
125423
|
+
continue;
|
|
125424
|
+
selected.push(result);
|
|
125425
|
+
selectedFiles.add(filePath);
|
|
125426
|
+
usedTokens += tokens;
|
|
125427
|
+
}
|
|
125428
|
+
for (const result of sorted) {
|
|
125429
|
+
if (selected.includes(result))
|
|
125430
|
+
continue;
|
|
125431
|
+
const content = result.content || result.preview || "";
|
|
125432
|
+
const tokens = estimateTokens(content, "code");
|
|
125433
|
+
if (usedTokens + tokens > tokenBudget)
|
|
125434
|
+
continue;
|
|
125435
|
+
selected.push(result);
|
|
125436
|
+
usedTokens += tokens;
|
|
125437
|
+
}
|
|
125438
|
+
return selected;
|
|
125439
|
+
}
|
|
125440
|
+
}
|
|
125441
|
+
function looksLikeSymbol(query) {
|
|
125442
|
+
if (query.length > 80)
|
|
125443
|
+
return false;
|
|
125444
|
+
const words = query.trim().split(/\s+/);
|
|
125445
|
+
if (words.length > 3)
|
|
125446
|
+
return false;
|
|
125447
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(words[0]);
|
|
125448
|
+
}
|
|
125449
|
+
function formatGraphContext(defs, refs, tokenBudget) {
|
|
125450
|
+
const parts = [`## Symbol Graph
|
|
125451
|
+
`];
|
|
125452
|
+
if (defs.length > 0) {
|
|
125453
|
+
parts.push(`### Definition(s)
|
|
125454
|
+
`);
|
|
125455
|
+
for (const def of defs.slice(0, 3)) {
|
|
125456
|
+
parts.push(`- **${def.kind}** \`${def.name}\` \u2192 \`${def.file}\` L${def.lineStart}\u2013${def.lineEnd}`);
|
|
125457
|
+
if (def.docComment)
|
|
125458
|
+
parts.push(` > ${def.docComment.slice(0, 120)}`);
|
|
125459
|
+
if (def.snippet) {
|
|
125460
|
+
parts.push(" ```");
|
|
125461
|
+
parts.push(def.snippet.split(`
|
|
125462
|
+
`).slice(0, 8).join(`
|
|
125463
|
+
`));
|
|
125464
|
+
parts.push(" ```");
|
|
125465
|
+
}
|
|
125466
|
+
}
|
|
125467
|
+
parts.push("");
|
|
125468
|
+
}
|
|
125469
|
+
if (refs.length > 0) {
|
|
125470
|
+
parts.push(`### References (${refs.length} total)
|
|
125471
|
+
`);
|
|
125472
|
+
const byFile = new Map;
|
|
125473
|
+
for (const r2 of refs.slice(0, 30)) {
|
|
125474
|
+
const arr = byFile.get(r2.fromFile) ?? [];
|
|
125475
|
+
arr.push(r2.fromLine);
|
|
125476
|
+
byFile.set(r2.fromFile, arr);
|
|
125477
|
+
}
|
|
125478
|
+
for (const [file3, lines] of byFile) {
|
|
125479
|
+
parts.push(`- \`${file3}\` L${lines.join(", ")}`);
|
|
125480
|
+
}
|
|
125481
|
+
parts.push("");
|
|
125482
|
+
}
|
|
125483
|
+
const section = parts.join(`
|
|
125484
|
+
`);
|
|
125485
|
+
const charBudget = tokenBudget * 4;
|
|
125486
|
+
return section.length > charBudget ? section.slice(0, charBudget) + `
|
|
125487
|
+
...
|
|
125488
|
+
` : section;
|
|
125489
|
+
}
|
|
125490
|
+
var init_context_controller = __esm(() => {
|
|
125491
|
+
init_dist();
|
|
125492
|
+
init_search_controller();
|
|
125493
|
+
init_memory_controller();
|
|
125494
|
+
init_compression();
|
|
125495
|
+
init_session_file_cache();
|
|
125496
|
+
init_symbol_graph_service();
|
|
125497
|
+
init_token_metrics();
|
|
125498
|
+
});
|
|
125499
|
+
|
|
125119
125500
|
// ../../packages/core/dist/services/checkpoint/checkpoint-store-pg.js
|
|
125120
125501
|
function toNum2(v) {
|
|
125121
125502
|
if (v == null)
|
|
@@ -127847,6 +128228,319 @@ var init_executor2 = __esm(() => {
|
|
|
127847
128228
|
init_intent_search();
|
|
127848
128229
|
});
|
|
127849
128230
|
|
|
128231
|
+
// ../../packages/core/dist/services/executor/executor-controller.js
|
|
128232
|
+
import { cpus as cpus2 } from "os";
|
|
128233
|
+
function applyIntent(result, intent) {
|
|
128234
|
+
if (!intent || !result.stdout)
|
|
128235
|
+
return result;
|
|
128236
|
+
const ir = intentSearch(result.stdout, intent);
|
|
128237
|
+
if (!ir.searched)
|
|
128238
|
+
return result;
|
|
128239
|
+
const rendered = renderIntentResult(ir, intent);
|
|
128240
|
+
return {
|
|
128241
|
+
...result,
|
|
128242
|
+
stdout: `${rendered}
|
|
128243
|
+
|
|
128244
|
+
--- tail (last 512 chars) ---
|
|
128245
|
+
${result.stdout.slice(-512)}`
|
|
128246
|
+
};
|
|
128247
|
+
}
|
|
128248
|
+
|
|
128249
|
+
class ExecutorController {
|
|
128250
|
+
static instance = null;
|
|
128251
|
+
executor;
|
|
128252
|
+
constructor(executor) {
|
|
128253
|
+
this.executor = executor ?? new PolyglotExecutor;
|
|
128254
|
+
}
|
|
128255
|
+
static getInstance() {
|
|
128256
|
+
if (!ExecutorController.instance) {
|
|
128257
|
+
ExecutorController.instance = new ExecutorController;
|
|
128258
|
+
}
|
|
128259
|
+
return ExecutorController.instance;
|
|
128260
|
+
}
|
|
128261
|
+
static resetInstance() {
|
|
128262
|
+
ExecutorController.instance?.executor.cleanupBackgrounded();
|
|
128263
|
+
ExecutorController.instance = null;
|
|
128264
|
+
}
|
|
128265
|
+
get runtimes() {
|
|
128266
|
+
return this.executor.runtimes;
|
|
128267
|
+
}
|
|
128268
|
+
async execute(params) {
|
|
128269
|
+
try {
|
|
128270
|
+
const language = validateEnum("language", params.language, EXECUTOR_LANGUAGES);
|
|
128271
|
+
const result = await this.executor.execute({
|
|
128272
|
+
language,
|
|
128273
|
+
code: params.code,
|
|
128274
|
+
timeout: params.timeout,
|
|
128275
|
+
background: params.background,
|
|
128276
|
+
cwd: params.cwd
|
|
128277
|
+
});
|
|
128278
|
+
const finalResult = applyIntent(result, params.intent);
|
|
128279
|
+
const ok = !finalResult.timedOut && finalResult.exitCode === 0;
|
|
128280
|
+
return {
|
|
128281
|
+
success: ok,
|
|
128282
|
+
data: {
|
|
128283
|
+
stdout: finalResult.stdout,
|
|
128284
|
+
stderr: finalResult.stderr,
|
|
128285
|
+
exitCode: finalResult.exitCode,
|
|
128286
|
+
timedOut: finalResult.timedOut,
|
|
128287
|
+
backgrounded: finalResult.backgrounded ?? false,
|
|
128288
|
+
command: finalResult.command,
|
|
128289
|
+
cwd: finalResult.cwd,
|
|
128290
|
+
sandboxMode: finalResult.sandboxMode
|
|
128291
|
+
}
|
|
128292
|
+
};
|
|
128293
|
+
} catch (error51) {
|
|
128294
|
+
logger.error("execute failed", error51, {
|
|
128295
|
+
language: params.language
|
|
128296
|
+
});
|
|
128297
|
+
return {
|
|
128298
|
+
success: false,
|
|
128299
|
+
error: `execute failed: ${error51.message}`
|
|
128300
|
+
};
|
|
128301
|
+
}
|
|
128302
|
+
}
|
|
128303
|
+
async executeFile(params) {
|
|
128304
|
+
try {
|
|
128305
|
+
const language = validateEnum("language", params.language, EXECUTOR_LANGUAGES);
|
|
128306
|
+
const result = await this.executor.executeFile({
|
|
128307
|
+
path: params.path,
|
|
128308
|
+
language,
|
|
128309
|
+
code: params.code,
|
|
128310
|
+
timeout: params.timeout
|
|
128311
|
+
});
|
|
128312
|
+
const blocked = result.stderr?.startsWith("Blocked:");
|
|
128313
|
+
if (blocked) {
|
|
128314
|
+
return { success: false, error: result.stderr };
|
|
128315
|
+
}
|
|
128316
|
+
const finalResult = applyIntent(result, params.intent);
|
|
128317
|
+
const ok = !finalResult.timedOut && finalResult.exitCode === 0;
|
|
128318
|
+
return {
|
|
128319
|
+
success: ok,
|
|
128320
|
+
data: {
|
|
128321
|
+
stdout: finalResult.stdout,
|
|
128322
|
+
stderr: finalResult.stderr,
|
|
128323
|
+
exitCode: finalResult.exitCode,
|
|
128324
|
+
timedOut: finalResult.timedOut,
|
|
128325
|
+
command: finalResult.command,
|
|
128326
|
+
cwd: finalResult.cwd,
|
|
128327
|
+
sandboxMode: finalResult.sandboxMode
|
|
128328
|
+
}
|
|
128329
|
+
};
|
|
128330
|
+
} catch (error51) {
|
|
128331
|
+
logger.error("execute_file failed", error51, {
|
|
128332
|
+
path: params.path,
|
|
128333
|
+
language: params.language
|
|
128334
|
+
});
|
|
128335
|
+
return {
|
|
128336
|
+
success: false,
|
|
128337
|
+
error: `execute_file failed: ${error51.message}`
|
|
128338
|
+
};
|
|
128339
|
+
}
|
|
128340
|
+
}
|
|
128341
|
+
async batchExecute(params) {
|
|
128342
|
+
const { commands, concurrency, cwd, timeout } = params;
|
|
128343
|
+
if (!Array.isArray(commands) || commands.length === 0) {
|
|
128344
|
+
return { success: false, error: "commands must be a non-empty array." };
|
|
128345
|
+
}
|
|
128346
|
+
if (commands.length > MAX_BATCH_COMMANDS) {
|
|
128347
|
+
return {
|
|
128348
|
+
success: false,
|
|
128349
|
+
error: `batch_execute accepts at most ${MAX_BATCH_COMMANDS} commands; received ${commands.length}. Split the batch or reduce the payload.`
|
|
128350
|
+
};
|
|
128351
|
+
}
|
|
128352
|
+
const effectiveConcurrency = concurrency && concurrency > 0 ? concurrency : Math.max(1, cpus2().length);
|
|
128353
|
+
const perTimeout = timeout ?? DEFAULT_TIMEOUT_MS2;
|
|
128354
|
+
try {
|
|
128355
|
+
const poolResult = await runPool(commands.map((cmd) => ({
|
|
128356
|
+
run: () => this.executor.execute({
|
|
128357
|
+
language: "shell",
|
|
128358
|
+
code: cmd,
|
|
128359
|
+
timeout: perTimeout,
|
|
128360
|
+
cwd
|
|
128361
|
+
})
|
|
128362
|
+
})), { concurrency: effectiveConcurrency });
|
|
128363
|
+
const results = poolResult.settled.map((s, i) => {
|
|
128364
|
+
if (s.status === "fulfilled") {
|
|
128365
|
+
const r2 = s.value;
|
|
128366
|
+
return {
|
|
128367
|
+
command: commands[i],
|
|
128368
|
+
stdout: r2.stdout,
|
|
128369
|
+
stderr: r2.stderr,
|
|
128370
|
+
exitCode: r2.exitCode,
|
|
128371
|
+
timedOut: r2.timedOut,
|
|
128372
|
+
sandboxMode: r2.sandboxMode
|
|
128373
|
+
};
|
|
128374
|
+
}
|
|
128375
|
+
return {
|
|
128376
|
+
command: commands[i],
|
|
128377
|
+
stdout: "",
|
|
128378
|
+
stderr: String(s.reason ?? "unknown error"),
|
|
128379
|
+
exitCode: null,
|
|
128380
|
+
timedOut: false,
|
|
128381
|
+
sandboxMode: getSandboxMode()
|
|
128382
|
+
};
|
|
128383
|
+
});
|
|
128384
|
+
const anyFailed = results.some((r2) => r2.exitCode !== 0 || r2.timedOut);
|
|
128385
|
+
return {
|
|
128386
|
+
success: !anyFailed,
|
|
128387
|
+
data: {
|
|
128388
|
+
results,
|
|
128389
|
+
concurrency: poolResult.effectiveConcurrency,
|
|
128390
|
+
capped: poolResult.capped
|
|
128391
|
+
}
|
|
128392
|
+
};
|
|
128393
|
+
} catch (error51) {
|
|
128394
|
+
logger.error("batch_execute failed", error51);
|
|
128395
|
+
return {
|
|
128396
|
+
success: false,
|
|
128397
|
+
error: `batch_execute failed: ${error51.message}`
|
|
128398
|
+
};
|
|
128399
|
+
}
|
|
128400
|
+
}
|
|
128401
|
+
static get MAX_TIMEOUT_MS() {
|
|
128402
|
+
return MAX_TIMEOUT_MS;
|
|
128403
|
+
}
|
|
128404
|
+
}
|
|
128405
|
+
var EXECUTOR_LANGUAGES, MAX_BATCH_COMMANDS = 256;
|
|
128406
|
+
var init_executor_controller = __esm(() => {
|
|
128407
|
+
init_dist();
|
|
128408
|
+
init_executor2();
|
|
128409
|
+
init_enum_validation();
|
|
128410
|
+
EXECUTOR_LANGUAGES = [
|
|
128411
|
+
"javascript",
|
|
128412
|
+
"typescript",
|
|
128413
|
+
"python",
|
|
128414
|
+
"shell",
|
|
128415
|
+
"ruby",
|
|
128416
|
+
"go",
|
|
128417
|
+
"rust",
|
|
128418
|
+
"php",
|
|
128419
|
+
"perl",
|
|
128420
|
+
"r"
|
|
128421
|
+
];
|
|
128422
|
+
});
|
|
128423
|
+
|
|
128424
|
+
// ../../packages/core/dist/services/symbol/graph-controller.js
|
|
128425
|
+
class GraphController {
|
|
128426
|
+
static instance = null;
|
|
128427
|
+
constructor() {}
|
|
128428
|
+
static getInstance() {
|
|
128429
|
+
if (!GraphController.instance) {
|
|
128430
|
+
GraphController.instance = new GraphController;
|
|
128431
|
+
}
|
|
128432
|
+
return GraphController.instance;
|
|
128433
|
+
}
|
|
128434
|
+
async tracePath(input) {
|
|
128435
|
+
const projectId = input.projectId;
|
|
128436
|
+
const seed = input.function_name ?? input.symbol ?? input.qualifiedName;
|
|
128437
|
+
if (!projectId)
|
|
128438
|
+
throw new Error("projectId is required");
|
|
128439
|
+
if (!seed)
|
|
128440
|
+
throw new Error("function_name (or symbol/qualifiedName) is required");
|
|
128441
|
+
const t0 = performance.now();
|
|
128442
|
+
const result = await tracePathService.tracePath({
|
|
128443
|
+
symbol: input.function_name ?? input.symbol ?? "",
|
|
128444
|
+
function_name: input.function_name,
|
|
128445
|
+
qualifiedName: input.qualifiedName,
|
|
128446
|
+
projectId,
|
|
128447
|
+
direction: input.direction,
|
|
128448
|
+
mode: input.mode,
|
|
128449
|
+
depth: input.depth,
|
|
128450
|
+
include_tests: input.include_tests,
|
|
128451
|
+
edge_types: input.edge_types
|
|
128452
|
+
});
|
|
128453
|
+
logger.info("GraphController: trace_path", {
|
|
128454
|
+
projectId,
|
|
128455
|
+
symbol: seed,
|
|
128456
|
+
mode: result.mode,
|
|
128457
|
+
direction: result.direction,
|
|
128458
|
+
seeds: result.seeds.length,
|
|
128459
|
+
nodes: result.nodes.length,
|
|
128460
|
+
edges: result.edges.length,
|
|
128461
|
+
durationMs: Math.round(performance.now() - t0)
|
|
128462
|
+
});
|
|
128463
|
+
if (result.seeds.length === 0) {
|
|
128464
|
+
return {
|
|
128465
|
+
found: false,
|
|
128466
|
+
symbol: seed,
|
|
128467
|
+
projectId,
|
|
128468
|
+
...result.identityResolution ? { identityResolution: result.identityResolution } : {},
|
|
128469
|
+
hint: "Use search_definitions(search=...) to find the exact name, or pass a fully-qualified name (qualifiedName='rel/path.ts#Name')."
|
|
128470
|
+
};
|
|
128471
|
+
}
|
|
128472
|
+
return {
|
|
128473
|
+
found: true,
|
|
128474
|
+
result: {
|
|
128475
|
+
projectId: result.projectId,
|
|
128476
|
+
symbol: result.symbol,
|
|
128477
|
+
mode: result.mode,
|
|
128478
|
+
direction: result.direction,
|
|
128479
|
+
edgeTypes: result.edgeTypes,
|
|
128480
|
+
seeds: result.seeds,
|
|
128481
|
+
truncated: result.truncated,
|
|
128482
|
+
nodes_total: result.nodes_total,
|
|
128483
|
+
nodes_shown: result.nodes_shown,
|
|
128484
|
+
nodes_omitted: result.nodes_omitted,
|
|
128485
|
+
nodeCount: result.nodes.length,
|
|
128486
|
+
edgeCount: result.edges.length,
|
|
128487
|
+
chains: result.chains,
|
|
128488
|
+
nodes: result.nodes,
|
|
128489
|
+
edges: result.edges,
|
|
128490
|
+
...result.identityResolution ? { identity: toSymbolIdentityResolution(result.identityResolution) } : {}
|
|
128491
|
+
}
|
|
128492
|
+
};
|
|
128493
|
+
}
|
|
128494
|
+
async analyzeImpact(input) {
|
|
128495
|
+
if (!input.projectId)
|
|
128496
|
+
throw new Error("projectId is required");
|
|
128497
|
+
if (!input.projectPath)
|
|
128498
|
+
throw new Error("projectPath is required");
|
|
128499
|
+
const t0 = performance.now();
|
|
128500
|
+
const result = await impactAnalysisService.analyze({
|
|
128501
|
+
projectId: input.projectId,
|
|
128502
|
+
projectPath: input.projectPath,
|
|
128503
|
+
scope: input.scope ?? "unstaged",
|
|
128504
|
+
baseBranch: input.base_branch,
|
|
128505
|
+
since: input.since,
|
|
128506
|
+
depth: input.depth,
|
|
128507
|
+
paths: input.paths,
|
|
128508
|
+
diffRunner: input.diffRunner
|
|
128509
|
+
});
|
|
128510
|
+
logger.info("GraphController: impact_analysis", {
|
|
128511
|
+
projectId: input.projectId,
|
|
128512
|
+
scope: result.scope,
|
|
128513
|
+
changedFiles: result.changedFiles.length,
|
|
128514
|
+
impacted: result.impacted.length,
|
|
128515
|
+
truncated: result.truncated,
|
|
128516
|
+
durationMs: Math.round(performance.now() - t0)
|
|
128517
|
+
});
|
|
128518
|
+
return {
|
|
128519
|
+
projectId: result.projectId,
|
|
128520
|
+
scope: result.scope,
|
|
128521
|
+
baseBranch: result.baseBranch,
|
|
128522
|
+
since: result.since,
|
|
128523
|
+
depth: result.depth,
|
|
128524
|
+
changedFileCount: result.changedFiles.length,
|
|
128525
|
+
changedFiles: result.changedFiles,
|
|
128526
|
+
impactedCount: result.impacted.length,
|
|
128527
|
+
truncated: result.truncated,
|
|
128528
|
+
impacted: result.impacted,
|
|
128529
|
+
untrackedFiltered: result.untrackedFiltered,
|
|
128530
|
+
impacted_total: result.impacted_total,
|
|
128531
|
+
impacted_shown: result.impacted_shown,
|
|
128532
|
+
impacted_omitted: result.impacted_omitted,
|
|
128533
|
+
note: result.note
|
|
128534
|
+
};
|
|
128535
|
+
}
|
|
128536
|
+
}
|
|
128537
|
+
var init_graph_controller = __esm(() => {
|
|
128538
|
+
init_dist();
|
|
128539
|
+
init_trace_path();
|
|
128540
|
+
init_impact_analysis();
|
|
128541
|
+
init_definition_lookup();
|
|
128542
|
+
});
|
|
128543
|
+
|
|
127850
128544
|
// ../../packages/core/dist/services/project-identity/errors.js
|
|
127851
128545
|
var ERROR_MESSAGES, ERROR_STATUS, ProjectIdentityError;
|
|
127852
128546
|
var init_errors4 = __esm(() => {
|
|
@@ -149777,6 +150471,7 @@ __export(exports_services, {
|
|
|
149777
150471
|
SessionFileCache: () => SessionFileCache,
|
|
149778
150472
|
SearchSessionHook: () => SearchSessionHook,
|
|
149779
150473
|
SearchServiceError: () => SearchServiceError,
|
|
150474
|
+
SearchController: () => SearchController,
|
|
149780
150475
|
SearchCachePg: () => SearchCachePg,
|
|
149781
150476
|
SearchAnalyticsPg: () => SearchAnalyticsPg,
|
|
149782
150477
|
Scheduler: () => Scheduler,
|
|
@@ -149810,6 +150505,7 @@ __export(exports_services, {
|
|
|
149810
150505
|
ModelsDevClient: () => ModelsDevClient,
|
|
149811
150506
|
MemoryService: () => MemoryService,
|
|
149812
150507
|
MemoryGraphService: () => MemoryGraphService,
|
|
150508
|
+
MemoryController: () => MemoryController,
|
|
149813
150509
|
MemoryClustering: () => MemoryClustering,
|
|
149814
150510
|
MAX_TIMEOUT_MS: () => MAX_TIMEOUT_MS,
|
|
149815
150511
|
MAX_STRUCTURAL_PARSER_CAPACITY: () => MAX_STRUCTURAL_PARSER_CAPACITY,
|
|
@@ -149828,10 +150524,12 @@ __export(exports_services, {
|
|
|
149828
150524
|
ImpactAnalysisService: () => ImpactAnalysisService,
|
|
149829
150525
|
GraphStorePg: () => GraphStorePg,
|
|
149830
150526
|
GraphQueries: () => GraphQueries,
|
|
150527
|
+
GraphController: () => GraphController,
|
|
149831
150528
|
GO_QUERY_PACK: () => GO_QUERY_PACK,
|
|
149832
150529
|
FqnHashCollisionError: () => FqnHashCollisionError,
|
|
149833
150530
|
FUNCTIONAL_QUERY_PACKS: () => FUNCTIONAL_QUERY_PACKS,
|
|
149834
150531
|
FUNCTIONAL_LANGUAGE_RESOLVER: () => FUNCTIONAL_LANGUAGE_RESOLVER,
|
|
150532
|
+
ExecutorController: () => ExecutorController,
|
|
149835
150533
|
EventBus: () => TypedEventBus,
|
|
149836
150534
|
EtlPipeline: () => EtlPipeline,
|
|
149837
150535
|
EmbeddingCachePg: () => EmbeddingCachePg,
|
|
@@ -149853,6 +150551,7 @@ __export(exports_services, {
|
|
|
149853
150551
|
DATA_DOCUMENT_QUERY_PACKS: () => DATA_DOCUMENT_QUERY_PACKS,
|
|
149854
150552
|
DATA_DOCUMENT_LANGUAGE_RESOLVER: () => DATA_DOCUMENT_LANGUAGE_RESOLVER,
|
|
149855
150553
|
ContextualSearchRLM: () => ContextualSearchRLM,
|
|
150554
|
+
ContextController: () => ContextController,
|
|
149856
150555
|
CompactionSnapshotService: () => CompactionSnapshotService,
|
|
149857
150556
|
CodeCompressor: () => CodeCompressor,
|
|
149858
150557
|
CoRetrievalHook: () => CoRetrievalHook,
|
|
@@ -149869,6 +150568,11 @@ var init_services = __esm(() => {
|
|
|
149869
150568
|
init_search_analytics_pg();
|
|
149870
150569
|
init_index_manager();
|
|
149871
150570
|
init_search_diagnostics();
|
|
150571
|
+
init_memory_controller();
|
|
150572
|
+
init_search_controller();
|
|
150573
|
+
init_context_controller();
|
|
150574
|
+
init_executor_controller();
|
|
150575
|
+
init_graph_controller();
|
|
149872
150576
|
init_l1_memory_cache();
|
|
149873
150577
|
init_embedding_cache_pg();
|
|
149874
150578
|
init_code_compressor();
|
|
@@ -150399,199 +151103,70 @@ class TypeBoxError extends Error {
|
|
|
150399
151103
|
super(message);
|
|
150400
151104
|
}
|
|
150401
151105
|
}
|
|
150402
|
-
|
|
150403
|
-
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
150404
|
-
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
150405
|
-
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
150406
|
-
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
150407
|
-
var Hint = Symbol.for("TypeBox.Hint");
|
|
150408
|
-
var Kind = Symbol.for("TypeBox.Kind");
|
|
150409
|
-
|
|
150410
|
-
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
150411
|
-
function IsReadonly(value) {
|
|
150412
|
-
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
150413
|
-
}
|
|
150414
|
-
function IsOptional(value) {
|
|
150415
|
-
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
150416
|
-
}
|
|
150417
|
-
function IsAny(value) {
|
|
150418
|
-
return IsKindOf(value, "Any");
|
|
150419
|
-
}
|
|
150420
|
-
function IsArgument(value) {
|
|
150421
|
-
return IsKindOf(value, "Argument");
|
|
150422
|
-
}
|
|
150423
|
-
function IsArray3(value) {
|
|
150424
|
-
return IsKindOf(value, "Array");
|
|
150425
|
-
}
|
|
150426
|
-
function IsAsyncIterator3(value) {
|
|
150427
|
-
return IsKindOf(value, "AsyncIterator");
|
|
150428
|
-
}
|
|
150429
|
-
function IsBigInt3(value) {
|
|
150430
|
-
return IsKindOf(value, "BigInt");
|
|
150431
|
-
}
|
|
150432
|
-
function IsBoolean3(value) {
|
|
150433
|
-
return IsKindOf(value, "Boolean");
|
|
150434
|
-
}
|
|
150435
|
-
function IsComputed(value) {
|
|
150436
|
-
return IsKindOf(value, "Computed");
|
|
150437
|
-
}
|
|
150438
|
-
function IsConstructor(value) {
|
|
150439
|
-
return IsKindOf(value, "Constructor");
|
|
150440
|
-
}
|
|
150441
|
-
function IsDate3(value) {
|
|
150442
|
-
return IsKindOf(value, "Date");
|
|
150443
|
-
}
|
|
150444
|
-
function IsFunction3(value) {
|
|
150445
|
-
return IsKindOf(value, "Function");
|
|
150446
|
-
}
|
|
150447
|
-
function IsInteger2(value) {
|
|
150448
|
-
return IsKindOf(value, "Integer");
|
|
150449
|
-
}
|
|
150450
|
-
function IsIntersect(value) {
|
|
150451
|
-
return IsKindOf(value, "Intersect");
|
|
150452
|
-
}
|
|
150453
|
-
function IsIterator3(value) {
|
|
150454
|
-
return IsKindOf(value, "Iterator");
|
|
150455
|
-
}
|
|
150456
|
-
function IsKindOf(value, kind) {
|
|
150457
|
-
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
150458
|
-
}
|
|
150459
|
-
function IsLiteralValue(value) {
|
|
150460
|
-
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
150461
|
-
}
|
|
150462
|
-
function IsLiteral(value) {
|
|
150463
|
-
return IsKindOf(value, "Literal");
|
|
150464
|
-
}
|
|
150465
|
-
function IsMappedKey(value) {
|
|
150466
|
-
return IsKindOf(value, "MappedKey");
|
|
150467
|
-
}
|
|
150468
|
-
function IsMappedResult(value) {
|
|
150469
|
-
return IsKindOf(value, "MappedResult");
|
|
150470
|
-
}
|
|
150471
|
-
function IsNever(value) {
|
|
150472
|
-
return IsKindOf(value, "Never");
|
|
150473
|
-
}
|
|
150474
|
-
function IsNot(value) {
|
|
150475
|
-
return IsKindOf(value, "Not");
|
|
150476
|
-
}
|
|
150477
|
-
function IsNull3(value) {
|
|
150478
|
-
return IsKindOf(value, "Null");
|
|
150479
|
-
}
|
|
150480
|
-
function IsNumber3(value) {
|
|
150481
|
-
return IsKindOf(value, "Number");
|
|
150482
|
-
}
|
|
150483
|
-
function IsObject3(value) {
|
|
150484
|
-
return IsKindOf(value, "Object");
|
|
150485
|
-
}
|
|
150486
|
-
function IsPromise2(value) {
|
|
150487
|
-
return IsKindOf(value, "Promise");
|
|
150488
|
-
}
|
|
150489
|
-
function IsRecord(value) {
|
|
150490
|
-
return IsKindOf(value, "Record");
|
|
150491
|
-
}
|
|
150492
|
-
function IsRef(value) {
|
|
150493
|
-
return IsKindOf(value, "Ref");
|
|
150494
|
-
}
|
|
150495
|
-
function IsRegExp2(value) {
|
|
150496
|
-
return IsKindOf(value, "RegExp");
|
|
150497
|
-
}
|
|
150498
|
-
function IsString3(value) {
|
|
150499
|
-
return IsKindOf(value, "String");
|
|
150500
|
-
}
|
|
150501
|
-
function IsSymbol3(value) {
|
|
150502
|
-
return IsKindOf(value, "Symbol");
|
|
150503
|
-
}
|
|
150504
|
-
function IsTemplateLiteral(value) {
|
|
150505
|
-
return IsKindOf(value, "TemplateLiteral");
|
|
150506
|
-
}
|
|
150507
|
-
function IsThis(value) {
|
|
150508
|
-
return IsKindOf(value, "This");
|
|
150509
|
-
}
|
|
150510
|
-
function IsTransform(value) {
|
|
150511
|
-
return IsObject(value) && TransformKind in value;
|
|
150512
|
-
}
|
|
150513
|
-
function IsTuple(value) {
|
|
150514
|
-
return IsKindOf(value, "Tuple");
|
|
150515
|
-
}
|
|
150516
|
-
function IsUndefined3(value) {
|
|
150517
|
-
return IsKindOf(value, "Undefined");
|
|
150518
|
-
}
|
|
150519
|
-
function IsUnion(value) {
|
|
150520
|
-
return IsKindOf(value, "Union");
|
|
150521
|
-
}
|
|
150522
|
-
function IsUint8Array3(value) {
|
|
150523
|
-
return IsKindOf(value, "Uint8Array");
|
|
150524
|
-
}
|
|
150525
|
-
function IsUnknown(value) {
|
|
150526
|
-
return IsKindOf(value, "Unknown");
|
|
150527
|
-
}
|
|
150528
|
-
function IsUnsafe(value) {
|
|
150529
|
-
return IsKindOf(value, "Unsafe");
|
|
150530
|
-
}
|
|
150531
|
-
function IsVoid(value) {
|
|
150532
|
-
return IsKindOf(value, "Void");
|
|
150533
|
-
}
|
|
150534
|
-
function IsKind(value) {
|
|
150535
|
-
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
150536
|
-
}
|
|
150537
|
-
function IsSchema(value) {
|
|
150538
|
-
return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed(value) || IsConstructor(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect(value) || IsIterator3(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array3(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
150539
|
-
}
|
|
150540
151106
|
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
150541
151107
|
var exports_type = {};
|
|
150542
151108
|
__export(exports_type, {
|
|
150543
151109
|
TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError,
|
|
150544
|
-
IsVoid: () =>
|
|
150545
|
-
IsUnsafe: () =>
|
|
150546
|
-
IsUnknown: () =>
|
|
151110
|
+
IsVoid: () => IsVoid,
|
|
151111
|
+
IsUnsafe: () => IsUnsafe,
|
|
151112
|
+
IsUnknown: () => IsUnknown,
|
|
150547
151113
|
IsUnionLiteral: () => IsUnionLiteral,
|
|
150548
|
-
IsUnion: () =>
|
|
150549
|
-
IsUndefined: () =>
|
|
150550
|
-
IsUint8Array: () =>
|
|
150551
|
-
IsTuple: () =>
|
|
150552
|
-
IsTransform: () =>
|
|
150553
|
-
IsThis: () =>
|
|
150554
|
-
IsTemplateLiteral: () =>
|
|
150555
|
-
IsSymbol: () =>
|
|
150556
|
-
IsString: () =>
|
|
150557
|
-
IsSchema: () =>
|
|
150558
|
-
IsRegExp: () =>
|
|
150559
|
-
IsRef: () =>
|
|
151114
|
+
IsUnion: () => IsUnion,
|
|
151115
|
+
IsUndefined: () => IsUndefined3,
|
|
151116
|
+
IsUint8Array: () => IsUint8Array3,
|
|
151117
|
+
IsTuple: () => IsTuple,
|
|
151118
|
+
IsTransform: () => IsTransform,
|
|
151119
|
+
IsThis: () => IsThis,
|
|
151120
|
+
IsTemplateLiteral: () => IsTemplateLiteral,
|
|
151121
|
+
IsSymbol: () => IsSymbol3,
|
|
151122
|
+
IsString: () => IsString3,
|
|
151123
|
+
IsSchema: () => IsSchema,
|
|
151124
|
+
IsRegExp: () => IsRegExp2,
|
|
151125
|
+
IsRef: () => IsRef,
|
|
150560
151126
|
IsRecursive: () => IsRecursive,
|
|
150561
|
-
IsRecord: () =>
|
|
150562
|
-
IsReadonly: () =>
|
|
151127
|
+
IsRecord: () => IsRecord,
|
|
151128
|
+
IsReadonly: () => IsReadonly,
|
|
150563
151129
|
IsProperties: () => IsProperties,
|
|
150564
|
-
IsPromise: () =>
|
|
150565
|
-
IsOptional: () =>
|
|
150566
|
-
IsObject: () =>
|
|
150567
|
-
IsNumber: () =>
|
|
150568
|
-
IsNull: () =>
|
|
150569
|
-
IsNot: () =>
|
|
150570
|
-
IsNever: () =>
|
|
150571
|
-
IsMappedResult: () =>
|
|
150572
|
-
IsMappedKey: () =>
|
|
150573
|
-
IsLiteralValue: () =>
|
|
151130
|
+
IsPromise: () => IsPromise2,
|
|
151131
|
+
IsOptional: () => IsOptional,
|
|
151132
|
+
IsObject: () => IsObject3,
|
|
151133
|
+
IsNumber: () => IsNumber3,
|
|
151134
|
+
IsNull: () => IsNull3,
|
|
151135
|
+
IsNot: () => IsNot,
|
|
151136
|
+
IsNever: () => IsNever,
|
|
151137
|
+
IsMappedResult: () => IsMappedResult,
|
|
151138
|
+
IsMappedKey: () => IsMappedKey,
|
|
151139
|
+
IsLiteralValue: () => IsLiteralValue,
|
|
150574
151140
|
IsLiteralString: () => IsLiteralString,
|
|
150575
151141
|
IsLiteralNumber: () => IsLiteralNumber,
|
|
150576
151142
|
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
150577
|
-
IsLiteral: () =>
|
|
150578
|
-
IsKindOf: () =>
|
|
150579
|
-
IsKind: () =>
|
|
150580
|
-
IsIterator: () =>
|
|
150581
|
-
IsIntersect: () =>
|
|
150582
|
-
IsInteger: () =>
|
|
151143
|
+
IsLiteral: () => IsLiteral,
|
|
151144
|
+
IsKindOf: () => IsKindOf,
|
|
151145
|
+
IsKind: () => IsKind,
|
|
151146
|
+
IsIterator: () => IsIterator3,
|
|
151147
|
+
IsIntersect: () => IsIntersect,
|
|
151148
|
+
IsInteger: () => IsInteger2,
|
|
150583
151149
|
IsImport: () => IsImport,
|
|
150584
|
-
IsFunction: () =>
|
|
150585
|
-
IsDate: () =>
|
|
150586
|
-
IsConstructor: () =>
|
|
150587
|
-
IsComputed: () =>
|
|
150588
|
-
IsBoolean: () =>
|
|
150589
|
-
IsBigInt: () =>
|
|
150590
|
-
IsAsyncIterator: () =>
|
|
150591
|
-
IsArray: () =>
|
|
150592
|
-
IsArgument: () =>
|
|
150593
|
-
IsAny: () =>
|
|
151150
|
+
IsFunction: () => IsFunction3,
|
|
151151
|
+
IsDate: () => IsDate3,
|
|
151152
|
+
IsConstructor: () => IsConstructor,
|
|
151153
|
+
IsComputed: () => IsComputed,
|
|
151154
|
+
IsBoolean: () => IsBoolean3,
|
|
151155
|
+
IsBigInt: () => IsBigInt3,
|
|
151156
|
+
IsAsyncIterator: () => IsAsyncIterator3,
|
|
151157
|
+
IsArray: () => IsArray3,
|
|
151158
|
+
IsArgument: () => IsArgument,
|
|
151159
|
+
IsAny: () => IsAny
|
|
150594
151160
|
});
|
|
151161
|
+
|
|
151162
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
151163
|
+
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
151164
|
+
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
151165
|
+
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
151166
|
+
var Hint = Symbol.for("TypeBox.Hint");
|
|
151167
|
+
var Kind = Symbol.for("TypeBox.Kind");
|
|
151168
|
+
|
|
151169
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
150595
151170
|
class TypeGuardUnknownTypeError extends TypeBoxError {
|
|
150596
151171
|
}
|
|
150597
151172
|
var KnownTypes = [
|
|
@@ -150651,7 +151226,7 @@ function IsControlCharacterFree(value) {
|
|
|
150651
151226
|
return true;
|
|
150652
151227
|
}
|
|
150653
151228
|
function IsAdditionalProperties(value) {
|
|
150654
|
-
return IsOptionalBoolean(value) ||
|
|
151229
|
+
return IsOptionalBoolean(value) || IsSchema(value);
|
|
150655
151230
|
}
|
|
150656
151231
|
function IsOptionalBigInt(value) {
|
|
150657
151232
|
return IsUndefined(value) || IsBigInt(value);
|
|
@@ -150672,160 +151247,160 @@ function IsOptionalFormat(value) {
|
|
|
150672
151247
|
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
|
|
150673
151248
|
}
|
|
150674
151249
|
function IsOptionalSchema(value) {
|
|
150675
|
-
return IsUndefined(value) ||
|
|
151250
|
+
return IsUndefined(value) || IsSchema(value);
|
|
150676
151251
|
}
|
|
150677
|
-
function
|
|
151252
|
+
function IsReadonly(value) {
|
|
150678
151253
|
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
150679
151254
|
}
|
|
150680
|
-
function
|
|
151255
|
+
function IsOptional(value) {
|
|
150681
151256
|
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
150682
151257
|
}
|
|
150683
|
-
function
|
|
150684
|
-
return
|
|
151258
|
+
function IsAny(value) {
|
|
151259
|
+
return IsKindOf(value, "Any") && IsOptionalString(value.$id);
|
|
150685
151260
|
}
|
|
150686
|
-
function
|
|
150687
|
-
return
|
|
151261
|
+
function IsArgument(value) {
|
|
151262
|
+
return IsKindOf(value, "Argument") && IsNumber(value.index);
|
|
150688
151263
|
}
|
|
150689
|
-
function
|
|
150690
|
-
return
|
|
151264
|
+
function IsArray3(value) {
|
|
151265
|
+
return IsKindOf(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
|
|
150691
151266
|
}
|
|
150692
|
-
function
|
|
150693
|
-
return
|
|
151267
|
+
function IsAsyncIterator3(value) {
|
|
151268
|
+
return IsKindOf(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema(value.items);
|
|
150694
151269
|
}
|
|
150695
|
-
function
|
|
150696
|
-
return
|
|
151270
|
+
function IsBigInt3(value) {
|
|
151271
|
+
return IsKindOf(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
|
|
150697
151272
|
}
|
|
150698
|
-
function
|
|
150699
|
-
return
|
|
151273
|
+
function IsBoolean3(value) {
|
|
151274
|
+
return IsKindOf(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
|
|
150700
151275
|
}
|
|
150701
|
-
function
|
|
150702
|
-
return
|
|
151276
|
+
function IsComputed(value) {
|
|
151277
|
+
return IsKindOf(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema(schema));
|
|
150703
151278
|
}
|
|
150704
|
-
function
|
|
150705
|
-
return
|
|
151279
|
+
function IsConstructor(value) {
|
|
151280
|
+
return IsKindOf(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema(schema)) && IsSchema(value.returns);
|
|
150706
151281
|
}
|
|
150707
|
-
function
|
|
150708
|
-
return
|
|
151282
|
+
function IsDate3(value) {
|
|
151283
|
+
return IsKindOf(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
|
|
150709
151284
|
}
|
|
150710
|
-
function
|
|
150711
|
-
return
|
|
151285
|
+
function IsFunction3(value) {
|
|
151286
|
+
return IsKindOf(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema(schema)) && IsSchema(value.returns);
|
|
150712
151287
|
}
|
|
150713
151288
|
function IsImport(value) {
|
|
150714
|
-
return
|
|
151289
|
+
return IsKindOf(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
|
|
150715
151290
|
}
|
|
150716
|
-
function
|
|
150717
|
-
return
|
|
151291
|
+
function IsInteger2(value) {
|
|
151292
|
+
return IsKindOf(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
150718
151293
|
}
|
|
150719
151294
|
function IsProperties(value) {
|
|
150720
|
-
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) &&
|
|
151295
|
+
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema(schema));
|
|
150721
151296
|
}
|
|
150722
|
-
function
|
|
150723
|
-
return
|
|
151297
|
+
function IsIntersect(value) {
|
|
151298
|
+
return IsKindOf(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema(schema) && !IsTransform(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
|
|
150724
151299
|
}
|
|
150725
|
-
function
|
|
150726
|
-
return
|
|
151300
|
+
function IsIterator3(value) {
|
|
151301
|
+
return IsKindOf(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema(value.items);
|
|
150727
151302
|
}
|
|
150728
|
-
function
|
|
151303
|
+
function IsKindOf(value, kind) {
|
|
150729
151304
|
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
150730
151305
|
}
|
|
150731
151306
|
function IsLiteralString(value) {
|
|
150732
|
-
return
|
|
151307
|
+
return IsLiteral(value) && IsString(value.const);
|
|
150733
151308
|
}
|
|
150734
151309
|
function IsLiteralNumber(value) {
|
|
150735
|
-
return
|
|
151310
|
+
return IsLiteral(value) && IsNumber(value.const);
|
|
150736
151311
|
}
|
|
150737
151312
|
function IsLiteralBoolean(value) {
|
|
150738
|
-
return
|
|
151313
|
+
return IsLiteral(value) && IsBoolean(value.const);
|
|
150739
151314
|
}
|
|
150740
|
-
function
|
|
150741
|
-
return
|
|
151315
|
+
function IsLiteral(value) {
|
|
151316
|
+
return IsKindOf(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue(value.const);
|
|
150742
151317
|
}
|
|
150743
|
-
function
|
|
151318
|
+
function IsLiteralValue(value) {
|
|
150744
151319
|
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
150745
151320
|
}
|
|
150746
|
-
function
|
|
150747
|
-
return
|
|
151321
|
+
function IsMappedKey(value) {
|
|
151322
|
+
return IsKindOf(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
|
|
150748
151323
|
}
|
|
150749
|
-
function
|
|
150750
|
-
return
|
|
151324
|
+
function IsMappedResult(value) {
|
|
151325
|
+
return IsKindOf(value, "MappedResult") && IsProperties(value.properties);
|
|
150751
151326
|
}
|
|
150752
|
-
function
|
|
150753
|
-
return
|
|
151327
|
+
function IsNever(value) {
|
|
151328
|
+
return IsKindOf(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
|
|
150754
151329
|
}
|
|
150755
|
-
function
|
|
150756
|
-
return
|
|
151330
|
+
function IsNot(value) {
|
|
151331
|
+
return IsKindOf(value, "Not") && IsSchema(value.not);
|
|
150757
151332
|
}
|
|
150758
|
-
function
|
|
150759
|
-
return
|
|
151333
|
+
function IsNull3(value) {
|
|
151334
|
+
return IsKindOf(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
|
|
150760
151335
|
}
|
|
150761
|
-
function
|
|
150762
|
-
return
|
|
151336
|
+
function IsNumber3(value) {
|
|
151337
|
+
return IsKindOf(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
150763
151338
|
}
|
|
150764
|
-
function
|
|
150765
|
-
return
|
|
151339
|
+
function IsObject3(value) {
|
|
151340
|
+
return IsKindOf(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
|
|
150766
151341
|
}
|
|
150767
|
-
function
|
|
150768
|
-
return
|
|
151342
|
+
function IsPromise2(value) {
|
|
151343
|
+
return IsKindOf(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema(value.item);
|
|
150769
151344
|
}
|
|
150770
|
-
function
|
|
150771
|
-
return
|
|
151345
|
+
function IsRecord(value) {
|
|
151346
|
+
return IsKindOf(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
|
|
150772
151347
|
const keys = Object.getOwnPropertyNames(schema.patternProperties);
|
|
150773
|
-
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) &&
|
|
151348
|
+
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema(schema.patternProperties[keys[0]]);
|
|
150774
151349
|
})(value);
|
|
150775
151350
|
}
|
|
150776
151351
|
function IsRecursive(value) {
|
|
150777
151352
|
return IsObject(value) && Hint in value && value[Hint] === "Recursive";
|
|
150778
151353
|
}
|
|
150779
|
-
function
|
|
150780
|
-
return
|
|
151354
|
+
function IsRef(value) {
|
|
151355
|
+
return IsKindOf(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
150781
151356
|
}
|
|
150782
|
-
function
|
|
150783
|
-
return
|
|
151357
|
+
function IsRegExp2(value) {
|
|
151358
|
+
return IsKindOf(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
|
|
150784
151359
|
}
|
|
150785
|
-
function
|
|
150786
|
-
return
|
|
151360
|
+
function IsString3(value) {
|
|
151361
|
+
return IsKindOf(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
|
|
150787
151362
|
}
|
|
150788
|
-
function
|
|
150789
|
-
return
|
|
151363
|
+
function IsSymbol3(value) {
|
|
151364
|
+
return IsKindOf(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
|
|
150790
151365
|
}
|
|
150791
|
-
function
|
|
150792
|
-
return
|
|
151366
|
+
function IsTemplateLiteral(value) {
|
|
151367
|
+
return IsKindOf(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
|
|
150793
151368
|
}
|
|
150794
|
-
function
|
|
150795
|
-
return
|
|
151369
|
+
function IsThis(value) {
|
|
151370
|
+
return IsKindOf(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
150796
151371
|
}
|
|
150797
|
-
function
|
|
151372
|
+
function IsTransform(value) {
|
|
150798
151373
|
return IsObject(value) && TransformKind in value;
|
|
150799
151374
|
}
|
|
150800
|
-
function
|
|
150801
|
-
return
|
|
151375
|
+
function IsTuple(value) {
|
|
151376
|
+
return IsKindOf(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema(schema)));
|
|
150802
151377
|
}
|
|
150803
|
-
function
|
|
150804
|
-
return
|
|
151378
|
+
function IsUndefined3(value) {
|
|
151379
|
+
return IsKindOf(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
|
|
150805
151380
|
}
|
|
150806
151381
|
function IsUnionLiteral(value) {
|
|
150807
|
-
return
|
|
151382
|
+
return IsUnion(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
|
|
150808
151383
|
}
|
|
150809
|
-
function
|
|
150810
|
-
return
|
|
151384
|
+
function IsUnion(value) {
|
|
151385
|
+
return IsKindOf(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema(schema));
|
|
150811
151386
|
}
|
|
150812
|
-
function
|
|
150813
|
-
return
|
|
151387
|
+
function IsUint8Array3(value) {
|
|
151388
|
+
return IsKindOf(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
|
|
150814
151389
|
}
|
|
150815
|
-
function
|
|
150816
|
-
return
|
|
151390
|
+
function IsUnknown(value) {
|
|
151391
|
+
return IsKindOf(value, "Unknown") && IsOptionalString(value.$id);
|
|
150817
151392
|
}
|
|
150818
|
-
function
|
|
150819
|
-
return
|
|
151393
|
+
function IsUnsafe(value) {
|
|
151394
|
+
return IsKindOf(value, "Unsafe");
|
|
150820
151395
|
}
|
|
150821
|
-
function
|
|
150822
|
-
return
|
|
151396
|
+
function IsVoid(value) {
|
|
151397
|
+
return IsKindOf(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
|
|
150823
151398
|
}
|
|
150824
|
-
function
|
|
151399
|
+
function IsKind(value) {
|
|
150825
151400
|
return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
|
|
150826
151401
|
}
|
|
150827
|
-
function
|
|
150828
|
-
return IsObject(value) && (
|
|
151402
|
+
function IsSchema(value) {
|
|
151403
|
+
return IsObject(value) && (IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed(value) || IsConstructor(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect(value) || IsIterator3(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array3(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value));
|
|
150829
151404
|
}
|
|
150830
151405
|
// ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
|
|
150831
151406
|
var PatternBoolean = "(true|false)";
|
|
@@ -150982,12 +151557,143 @@ function UnionCreate(T2, options) {
|
|
|
150982
151557
|
return CreateType({ [Kind]: "Union", anyOf: T2 }, options);
|
|
150983
151558
|
}
|
|
150984
151559
|
|
|
151560
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
151561
|
+
function IsReadonly2(value) {
|
|
151562
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
151563
|
+
}
|
|
151564
|
+
function IsOptional2(value) {
|
|
151565
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
151566
|
+
}
|
|
151567
|
+
function IsAny2(value) {
|
|
151568
|
+
return IsKindOf2(value, "Any");
|
|
151569
|
+
}
|
|
151570
|
+
function IsArgument2(value) {
|
|
151571
|
+
return IsKindOf2(value, "Argument");
|
|
151572
|
+
}
|
|
151573
|
+
function IsArray4(value) {
|
|
151574
|
+
return IsKindOf2(value, "Array");
|
|
151575
|
+
}
|
|
151576
|
+
function IsAsyncIterator4(value) {
|
|
151577
|
+
return IsKindOf2(value, "AsyncIterator");
|
|
151578
|
+
}
|
|
151579
|
+
function IsBigInt4(value) {
|
|
151580
|
+
return IsKindOf2(value, "BigInt");
|
|
151581
|
+
}
|
|
151582
|
+
function IsBoolean4(value) {
|
|
151583
|
+
return IsKindOf2(value, "Boolean");
|
|
151584
|
+
}
|
|
151585
|
+
function IsComputed2(value) {
|
|
151586
|
+
return IsKindOf2(value, "Computed");
|
|
151587
|
+
}
|
|
151588
|
+
function IsConstructor2(value) {
|
|
151589
|
+
return IsKindOf2(value, "Constructor");
|
|
151590
|
+
}
|
|
151591
|
+
function IsDate4(value) {
|
|
151592
|
+
return IsKindOf2(value, "Date");
|
|
151593
|
+
}
|
|
151594
|
+
function IsFunction4(value) {
|
|
151595
|
+
return IsKindOf2(value, "Function");
|
|
151596
|
+
}
|
|
151597
|
+
function IsInteger3(value) {
|
|
151598
|
+
return IsKindOf2(value, "Integer");
|
|
151599
|
+
}
|
|
151600
|
+
function IsIntersect2(value) {
|
|
151601
|
+
return IsKindOf2(value, "Intersect");
|
|
151602
|
+
}
|
|
151603
|
+
function IsIterator4(value) {
|
|
151604
|
+
return IsKindOf2(value, "Iterator");
|
|
151605
|
+
}
|
|
151606
|
+
function IsKindOf2(value, kind) {
|
|
151607
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
151608
|
+
}
|
|
151609
|
+
function IsLiteralValue2(value) {
|
|
151610
|
+
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
151611
|
+
}
|
|
151612
|
+
function IsLiteral2(value) {
|
|
151613
|
+
return IsKindOf2(value, "Literal");
|
|
151614
|
+
}
|
|
151615
|
+
function IsMappedKey2(value) {
|
|
151616
|
+
return IsKindOf2(value, "MappedKey");
|
|
151617
|
+
}
|
|
151618
|
+
function IsMappedResult2(value) {
|
|
151619
|
+
return IsKindOf2(value, "MappedResult");
|
|
151620
|
+
}
|
|
151621
|
+
function IsNever2(value) {
|
|
151622
|
+
return IsKindOf2(value, "Never");
|
|
151623
|
+
}
|
|
151624
|
+
function IsNot2(value) {
|
|
151625
|
+
return IsKindOf2(value, "Not");
|
|
151626
|
+
}
|
|
151627
|
+
function IsNull4(value) {
|
|
151628
|
+
return IsKindOf2(value, "Null");
|
|
151629
|
+
}
|
|
151630
|
+
function IsNumber4(value) {
|
|
151631
|
+
return IsKindOf2(value, "Number");
|
|
151632
|
+
}
|
|
151633
|
+
function IsObject4(value) {
|
|
151634
|
+
return IsKindOf2(value, "Object");
|
|
151635
|
+
}
|
|
151636
|
+
function IsPromise3(value) {
|
|
151637
|
+
return IsKindOf2(value, "Promise");
|
|
151638
|
+
}
|
|
151639
|
+
function IsRecord2(value) {
|
|
151640
|
+
return IsKindOf2(value, "Record");
|
|
151641
|
+
}
|
|
151642
|
+
function IsRef2(value) {
|
|
151643
|
+
return IsKindOf2(value, "Ref");
|
|
151644
|
+
}
|
|
151645
|
+
function IsRegExp3(value) {
|
|
151646
|
+
return IsKindOf2(value, "RegExp");
|
|
151647
|
+
}
|
|
151648
|
+
function IsString4(value) {
|
|
151649
|
+
return IsKindOf2(value, "String");
|
|
151650
|
+
}
|
|
151651
|
+
function IsSymbol4(value) {
|
|
151652
|
+
return IsKindOf2(value, "Symbol");
|
|
151653
|
+
}
|
|
151654
|
+
function IsTemplateLiteral2(value) {
|
|
151655
|
+
return IsKindOf2(value, "TemplateLiteral");
|
|
151656
|
+
}
|
|
151657
|
+
function IsThis2(value) {
|
|
151658
|
+
return IsKindOf2(value, "This");
|
|
151659
|
+
}
|
|
151660
|
+
function IsTransform2(value) {
|
|
151661
|
+
return IsObject(value) && TransformKind in value;
|
|
151662
|
+
}
|
|
151663
|
+
function IsTuple2(value) {
|
|
151664
|
+
return IsKindOf2(value, "Tuple");
|
|
151665
|
+
}
|
|
151666
|
+
function IsUndefined4(value) {
|
|
151667
|
+
return IsKindOf2(value, "Undefined");
|
|
151668
|
+
}
|
|
151669
|
+
function IsUnion2(value) {
|
|
151670
|
+
return IsKindOf2(value, "Union");
|
|
151671
|
+
}
|
|
151672
|
+
function IsUint8Array4(value) {
|
|
151673
|
+
return IsKindOf2(value, "Uint8Array");
|
|
151674
|
+
}
|
|
151675
|
+
function IsUnknown2(value) {
|
|
151676
|
+
return IsKindOf2(value, "Unknown");
|
|
151677
|
+
}
|
|
151678
|
+
function IsUnsafe2(value) {
|
|
151679
|
+
return IsKindOf2(value, "Unsafe");
|
|
151680
|
+
}
|
|
151681
|
+
function IsVoid2(value) {
|
|
151682
|
+
return IsKindOf2(value, "Void");
|
|
151683
|
+
}
|
|
151684
|
+
function IsKind2(value) {
|
|
151685
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
151686
|
+
}
|
|
151687
|
+
function IsSchema2(value) {
|
|
151688
|
+
return IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean4(value) || IsBigInt4(value) || IsAsyncIterator4(value) || IsComputed2(value) || IsConstructor2(value) || IsDate4(value) || IsFunction4(value) || IsInteger3(value) || IsIntersect2(value) || IsIterator4(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull4(value) || IsNumber4(value) || IsObject4(value) || IsPromise3(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString4(value) || IsSymbol4(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array4(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value);
|
|
151689
|
+
}
|
|
151690
|
+
|
|
150985
151691
|
// ../../node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
|
|
150986
151692
|
function IsUnionOptional(types) {
|
|
150987
|
-
return types.some((type) =>
|
|
151693
|
+
return types.some((type) => IsOptional2(type));
|
|
150988
151694
|
}
|
|
150989
151695
|
function RemoveOptionalFromRest(types) {
|
|
150990
|
-
return types.map((left) =>
|
|
151696
|
+
return types.map((left) => IsOptional2(left) ? RemoveOptionalFromType(left) : left);
|
|
150991
151697
|
}
|
|
150992
151698
|
function RemoveOptionalFromType(T2) {
|
|
150993
151699
|
return Discard(T2, [OptionalKind]);
|
|
@@ -151256,7 +151962,7 @@ function Escape(value) {
|
|
|
151256
151962
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
151257
151963
|
}
|
|
151258
151964
|
function Visit2(schema, acc) {
|
|
151259
|
-
return
|
|
151965
|
+
return IsTemplateLiteral2(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion2(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber4(schema) ? `${acc}${PatternNumber}` : IsInteger3(schema) ? `${acc}${PatternNumber}` : IsBigInt4(schema) ? `${acc}${PatternNumber}` : IsString4(schema) ? `${acc}${PatternString}` : IsLiteral2(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean4(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
151260
151966
|
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
151261
151967
|
})();
|
|
151262
151968
|
}
|
|
@@ -151292,7 +151998,7 @@ function FromLiteral(literalValue) {
|
|
|
151292
151998
|
return [literalValue.toString()];
|
|
151293
151999
|
}
|
|
151294
152000
|
function IndexPropertyKeys(type) {
|
|
151295
|
-
return [...new Set(
|
|
152001
|
+
return [...new Set(IsTemplateLiteral2(type) ? FromTemplateLiteral(type) : IsUnion2(type) ? FromUnion2(type.anyOf) : IsLiteral2(type) ? FromLiteral(type.const) : IsNumber4(type) ? ["[number]"] : IsInteger3(type) ? ["[number]"] : [])];
|
|
151296
152002
|
}
|
|
151297
152003
|
|
|
151298
152004
|
// ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
|
|
@@ -151316,13 +152022,13 @@ function FromRest(types, key) {
|
|
|
151316
152022
|
return types.map((type) => IndexFromPropertyKey(type, key));
|
|
151317
152023
|
}
|
|
151318
152024
|
function FromIntersectRest(types) {
|
|
151319
|
-
return types.filter((type) => !
|
|
152025
|
+
return types.filter((type) => !IsNever2(type));
|
|
151320
152026
|
}
|
|
151321
152027
|
function FromIntersect(types, key) {
|
|
151322
152028
|
return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
|
|
151323
152029
|
}
|
|
151324
152030
|
function FromUnionRest(types) {
|
|
151325
|
-
return types.some((L) =>
|
|
152031
|
+
return types.some((L) => IsNever2(L)) ? [] : types;
|
|
151326
152032
|
}
|
|
151327
152033
|
function FromUnion3(types, key) {
|
|
151328
152034
|
return UnionEvaluated(FromUnionRest(FromRest(types, key)));
|
|
@@ -151337,7 +152043,7 @@ function FromProperty(properties, propertyKey) {
|
|
|
151337
152043
|
return propertyKey in properties ? properties[propertyKey] : Never();
|
|
151338
152044
|
}
|
|
151339
152045
|
function IndexFromPropertyKey(type, propertyKey) {
|
|
151340
|
-
return
|
|
152046
|
+
return IsIntersect2(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion2(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple2(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray4(type) ? FromArray(type.items, propertyKey) : IsObject4(type) ? FromProperty(type.properties, propertyKey) : Never();
|
|
151341
152047
|
}
|
|
151342
152048
|
function IndexFromPropertyKeys(type, propertyKeys) {
|
|
151343
152049
|
return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
|
|
@@ -151346,17 +152052,17 @@ function FromSchema(type, propertyKeys) {
|
|
|
151346
152052
|
return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
|
|
151347
152053
|
}
|
|
151348
152054
|
function Index(type, key, options) {
|
|
151349
|
-
if (
|
|
152055
|
+
if (IsRef2(type) || IsRef2(key)) {
|
|
151350
152056
|
const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
|
|
151351
|
-
if (!
|
|
152057
|
+
if (!IsSchema2(type) || !IsSchema2(key))
|
|
151352
152058
|
throw new TypeBoxError(error);
|
|
151353
152059
|
return Computed("Index", [type, key]);
|
|
151354
152060
|
}
|
|
151355
|
-
if (
|
|
152061
|
+
if (IsMappedResult2(key))
|
|
151356
152062
|
return IndexFromMappedResult(type, key, options);
|
|
151357
|
-
if (
|
|
152063
|
+
if (IsMappedKey2(key))
|
|
151358
152064
|
return IndexFromMappedKey(type, key, options);
|
|
151359
|
-
return CreateType(
|
|
152065
|
+
return CreateType(IsSchema2(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
|
|
151360
152066
|
}
|
|
151361
152067
|
|
|
151362
152068
|
// ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
|
|
@@ -151383,7 +152089,7 @@ function Iterator(items, options) {
|
|
|
151383
152089
|
|
|
151384
152090
|
// ../../node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
|
|
151385
152091
|
function RequiredArray(properties) {
|
|
151386
|
-
return globalThis.Object.keys(properties).filter((key) => !
|
|
152092
|
+
return globalThis.Object.keys(properties).filter((key) => !IsOptional2(properties[key]));
|
|
151387
152093
|
}
|
|
151388
152094
|
function _Object(properties, options) {
|
|
151389
152095
|
const required = RequiredArray(properties);
|
|
@@ -151409,7 +152115,7 @@ function ReadonlyWithFlag(schema, F) {
|
|
|
151409
152115
|
}
|
|
151410
152116
|
function Readonly(schema, enable) {
|
|
151411
152117
|
const F = enable ?? true;
|
|
151412
|
-
return
|
|
152118
|
+
return IsMappedResult2(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
|
|
151413
152119
|
}
|
|
151414
152120
|
|
|
151415
152121
|
// ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
|
|
@@ -151463,7 +152169,7 @@ function FromProperties3(K, T2) {
|
|
|
151463
152169
|
}
|
|
151464
152170
|
function FromSchemaType(K, T2) {
|
|
151465
152171
|
const options = { ...T2 };
|
|
151466
|
-
return
|
|
152172
|
+
return IsOptional2(T2) ? Optional(FromSchemaType(K, Discard(T2, [OptionalKind]))) : IsReadonly2(T2) ? Readonly(FromSchemaType(K, Discard(T2, [ReadonlyKind]))) : IsMappedResult2(T2) ? FromMappedResult3(K, T2.properties) : IsMappedKey2(T2) ? FromMappedKey(K, T2.keys) : IsConstructor2(T2) ? Constructor(FromRest2(K, T2.parameters), FromSchemaType(K, T2.returns), options) : IsFunction4(T2) ? Function2(FromRest2(K, T2.parameters), FromSchemaType(K, T2.returns), options) : IsAsyncIterator4(T2) ? AsyncIterator(FromSchemaType(K, T2.items), options) : IsIterator4(T2) ? Iterator(FromSchemaType(K, T2.items), options) : IsIntersect2(T2) ? Intersect(FromRest2(K, T2.allOf), options) : IsUnion2(T2) ? Union(FromRest2(K, T2.anyOf), options) : IsTuple2(T2) ? Tuple(FromRest2(K, T2.items ?? []), options) : IsObject4(T2) ? Object2(FromProperties3(K, T2.properties), options) : IsArray4(T2) ? Array2(FromSchemaType(K, T2.items), options) : IsPromise3(T2) ? Promise2(FromSchemaType(K, T2.item), options) : T2;
|
|
151467
152173
|
}
|
|
151468
152174
|
function MappedFunctionReturnType(K, T2) {
|
|
151469
152175
|
const Acc = {};
|
|
@@ -151472,7 +152178,7 @@ function MappedFunctionReturnType(K, T2) {
|
|
|
151472
152178
|
return Acc;
|
|
151473
152179
|
}
|
|
151474
152180
|
function Mapped(key, map3, options) {
|
|
151475
|
-
const K =
|
|
152181
|
+
const K = IsSchema2(key) ? IndexPropertyKeys(key) : key;
|
|
151476
152182
|
const RT = map3({ [Kind]: "MappedKey", keys: K });
|
|
151477
152183
|
const R = MappedFunctionReturnType(K, RT);
|
|
151478
152184
|
return Object2(R, options);
|
|
@@ -151490,7 +152196,7 @@ function OptionalWithFlag(schema, F) {
|
|
|
151490
152196
|
}
|
|
151491
152197
|
function Optional(schema, enable) {
|
|
151492
152198
|
const F = enable ?? true;
|
|
151493
|
-
return
|
|
152199
|
+
return IsMappedResult2(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
|
|
151494
152200
|
}
|
|
151495
152201
|
|
|
151496
152202
|
// ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
|
|
@@ -151510,20 +152216,20 @@ function OptionalFromMappedResult(R, F) {
|
|
|
151510
152216
|
|
|
151511
152217
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
|
|
151512
152218
|
function IntersectCreate(T2, options = {}) {
|
|
151513
|
-
const allObjects = T2.every((schema) =>
|
|
151514
|
-
const clonedUnevaluatedProperties =
|
|
151515
|
-
return CreateType(options.unevaluatedProperties === false ||
|
|
152219
|
+
const allObjects = T2.every((schema) => IsObject4(schema));
|
|
152220
|
+
const clonedUnevaluatedProperties = IsSchema2(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
|
|
152221
|
+
return CreateType(options.unevaluatedProperties === false || IsSchema2(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T2 } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T2 }, options);
|
|
151516
152222
|
}
|
|
151517
152223
|
|
|
151518
152224
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
|
|
151519
152225
|
function IsIntersectOptional(types) {
|
|
151520
|
-
return types.every((left) =>
|
|
152226
|
+
return types.every((left) => IsOptional2(left));
|
|
151521
152227
|
}
|
|
151522
152228
|
function RemoveOptionalFromType2(type) {
|
|
151523
152229
|
return Discard(type, [OptionalKind]);
|
|
151524
152230
|
}
|
|
151525
152231
|
function RemoveOptionalFromRest2(types) {
|
|
151526
|
-
return types.map((left) =>
|
|
152232
|
+
return types.map((left) => IsOptional2(left) ? RemoveOptionalFromType2(left) : left);
|
|
151527
152233
|
}
|
|
151528
152234
|
function ResolveIntersect(types, options) {
|
|
151529
152235
|
return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
|
|
@@ -151533,7 +152239,7 @@ function IntersectEvaluated(types, options = {}) {
|
|
|
151533
152239
|
return CreateType(types[0], options);
|
|
151534
152240
|
if (types.length === 0)
|
|
151535
152241
|
return Never(options);
|
|
151536
|
-
if (types.some((schema) =>
|
|
152242
|
+
if (types.some((schema) => IsTransform2(schema)))
|
|
151537
152243
|
throw new Error("Cannot intersect transform types");
|
|
151538
152244
|
return ResolveIntersect(types, options);
|
|
151539
152245
|
}
|
|
@@ -151544,7 +152250,7 @@ function Intersect(types, options) {
|
|
|
151544
152250
|
return CreateType(types[0], options);
|
|
151545
152251
|
if (types.length === 0)
|
|
151546
152252
|
return Never(options);
|
|
151547
|
-
if (types.some((schema) =>
|
|
152253
|
+
if (types.some((schema) => IsTransform2(schema)))
|
|
151548
152254
|
throw new Error("Cannot intersect transform types");
|
|
151549
152255
|
return IntersectCreate(types, options);
|
|
151550
152256
|
}
|
|
@@ -151577,7 +152283,7 @@ function FromRest3(types) {
|
|
|
151577
152283
|
return types.map((type) => Awaited(type));
|
|
151578
152284
|
}
|
|
151579
152285
|
function Awaited(type, options) {
|
|
151580
|
-
return CreateType(
|
|
152286
|
+
return CreateType(IsComputed2(type) ? FromComputed(type.target, type.parameters) : IsIntersect2(type) ? FromIntersect2(type.allOf) : IsUnion2(type) ? FromUnion4(type.anyOf) : IsPromise3(type) ? FromPromise(type.item) : IsRef2(type) ? FromRef(type.$ref) : type, options);
|
|
151581
152287
|
}
|
|
151582
152288
|
|
|
151583
152289
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
|
|
@@ -151615,7 +152321,7 @@ function FromPatternProperties(patternProperties) {
|
|
|
151615
152321
|
});
|
|
151616
152322
|
}
|
|
151617
152323
|
function KeyOfPropertyKeys(type) {
|
|
151618
|
-
return
|
|
152324
|
+
return IsIntersect2(type) ? FromIntersect3(type.allOf) : IsUnion2(type) ? FromUnion5(type.anyOf) : IsTuple2(type) ? FromTuple2(type.items ?? []) : IsArray4(type) ? FromArray2(type.items) : IsObject4(type) ? FromProperties5(type.properties) : IsRecord2(type) ? FromPatternProperties(type.patternProperties) : [];
|
|
151619
152325
|
}
|
|
151620
152326
|
var includePatternProperties = false;
|
|
151621
152327
|
function KeyOfPattern(schema) {
|
|
@@ -151643,7 +152349,7 @@ function KeyOfPropertyKeysToRest(propertyKeys) {
|
|
|
151643
152349
|
return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
|
|
151644
152350
|
}
|
|
151645
152351
|
function KeyOf(type, options) {
|
|
151646
|
-
return
|
|
152352
|
+
return IsComputed2(type) ? FromComputed2(type.target, type.parameters) : IsRef2(type) ? FromRef2(type.$ref) : IsMappedResult2(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
|
|
151647
152353
|
}
|
|
151648
152354
|
|
|
151649
152355
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
|
|
@@ -151676,7 +152382,7 @@ function CompositeKeys(T2) {
|
|
|
151676
152382
|
return SetDistinct(Acc);
|
|
151677
152383
|
}
|
|
151678
152384
|
function FilterNever(T2) {
|
|
151679
|
-
return T2.filter((L) => !
|
|
152385
|
+
return T2.filter((L) => !IsNever2(L));
|
|
151680
152386
|
}
|
|
151681
152387
|
function CompositeProperty(T2, K) {
|
|
151682
152388
|
const Acc = [];
|
|
@@ -151750,7 +152456,7 @@ function Const(T2, options) {
|
|
|
151750
152456
|
|
|
151751
152457
|
// ../../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
|
|
151752
152458
|
function ConstructorParameters(schema, options) {
|
|
151753
|
-
return
|
|
152459
|
+
return IsConstructor2(schema) ? Tuple(schema.parameters, options) : Never(options);
|
|
151754
152460
|
}
|
|
151755
152461
|
|
|
151756
152462
|
// ../../node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
|
|
@@ -152029,7 +152735,7 @@ function ExtendsResolve(left, right, trueType, falseType) {
|
|
|
152029
152735
|
return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
|
|
152030
152736
|
}
|
|
152031
152737
|
function Extends(L, R, T2, F, options) {
|
|
152032
|
-
return
|
|
152738
|
+
return IsMappedResult2(L) ? ExtendsFromMappedResult(L, R, T2, F, options) : IsMappedKey2(L) ? CreateType(ExtendsFromMappedKey(L, R, T2, F, options)) : CreateType(ExtendsResolve(L, R, T2, F), options);
|
|
152033
152739
|
}
|
|
152034
152740
|
|
|
152035
152741
|
// ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
|
|
@@ -152076,11 +152782,11 @@ function ExcludeRest(L, R) {
|
|
|
152076
152782
|
return excluded.length === 1 ? excluded[0] : Union(excluded);
|
|
152077
152783
|
}
|
|
152078
152784
|
function Exclude(L, R, options = {}) {
|
|
152079
|
-
if (
|
|
152785
|
+
if (IsTemplateLiteral2(L))
|
|
152080
152786
|
return CreateType(ExcludeFromTemplateLiteral(L, R), options);
|
|
152081
|
-
if (
|
|
152787
|
+
if (IsMappedResult2(L))
|
|
152082
152788
|
return CreateType(ExcludeFromMappedResult(L, R), options);
|
|
152083
|
-
return CreateType(
|
|
152789
|
+
return CreateType(IsUnion2(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
|
|
152084
152790
|
}
|
|
152085
152791
|
|
|
152086
152792
|
// ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
|
|
@@ -152109,11 +152815,11 @@ function ExtractRest(L, R) {
|
|
|
152109
152815
|
return extracted.length === 1 ? extracted[0] : Union(extracted);
|
|
152110
152816
|
}
|
|
152111
152817
|
function Extract(L, R, options) {
|
|
152112
|
-
if (
|
|
152818
|
+
if (IsTemplateLiteral2(L))
|
|
152113
152819
|
return CreateType(ExtractFromTemplateLiteral(L, R), options);
|
|
152114
|
-
if (
|
|
152820
|
+
if (IsMappedResult2(L))
|
|
152115
152821
|
return CreateType(ExtractFromMappedResult(L, R), options);
|
|
152116
|
-
return CreateType(
|
|
152822
|
+
return CreateType(IsUnion2(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
|
|
152117
152823
|
}
|
|
152118
152824
|
|
|
152119
152825
|
// ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
|
|
@@ -152133,7 +152839,7 @@ function ExtractFromMappedResult(R, T2) {
|
|
|
152133
152839
|
|
|
152134
152840
|
// ../../node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
|
|
152135
152841
|
function InstanceType(schema, options) {
|
|
152136
|
-
return
|
|
152842
|
+
return IsConstructor2(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
152137
152843
|
}
|
|
152138
152844
|
|
|
152139
152845
|
// ../../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
|
|
@@ -152183,7 +152889,7 @@ function FromNumberKey(_2, type, options) {
|
|
|
152183
152889
|
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
152184
152890
|
}
|
|
152185
152891
|
function Record(key, type, options = {}) {
|
|
152186
|
-
return
|
|
152892
|
+
return IsUnion2(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral2(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral2(key) ? FromLiteralKey(key.const, type, options) : IsBoolean4(key) ? FromBooleanKey(key, type, options) : IsInteger3(key) ? FromIntegerKey(key, type, options) : IsNumber4(key) ? FromNumberKey(key, type, options) : IsRegExp3(key) ? FromRegExpKey(key, type, options) : IsString4(key) ? FromStringKey(key, type, options) : IsAny2(key) ? FromAnyKey(key, type, options) : IsNever2(key) ? FromNeverKey(key, type, options) : Never(options);
|
|
152187
152893
|
}
|
|
152188
152894
|
function RecordPattern(record) {
|
|
152189
152895
|
return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
|
|
@@ -152251,8 +152957,8 @@ function FromArgument(args, argument) {
|
|
|
152251
152957
|
return argument.index in args ? args[argument.index] : Unknown();
|
|
152252
152958
|
}
|
|
152253
152959
|
function FromProperty2(args, type) {
|
|
152254
|
-
const isReadonly =
|
|
152255
|
-
const isOptional =
|
|
152960
|
+
const isReadonly = IsReadonly2(type);
|
|
152961
|
+
const isOptional = IsOptional2(type);
|
|
152256
152962
|
const mapped = FromType(args, type);
|
|
152257
152963
|
return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
|
|
152258
152964
|
}
|
|
@@ -152265,7 +152971,7 @@ function FromTypes(args, types) {
|
|
|
152265
152971
|
return types.map((type) => FromType(args, type));
|
|
152266
152972
|
}
|
|
152267
152973
|
function FromType(args, type) {
|
|
152268
|
-
return
|
|
152974
|
+
return IsConstructor2(type) ? FromConstructor2(args, type) : IsFunction4(type) ? FromFunction2(args, type) : IsIntersect2(type) ? FromIntersect5(args, type) : IsUnion2(type) ? FromUnion7(args, type) : IsTuple2(type) ? FromTuple4(args, type) : IsArray4(type) ? FromArray5(args, type) : IsAsyncIterator4(type) ? FromAsyncIterator2(args, type) : IsIterator4(type) ? FromIterator2(args, type) : IsPromise3(type) ? FromPromise3(args, type) : IsObject4(type) ? FromObject2(args, type) : IsRecord2(type) ? FromRecord2(args, type) : IsArgument2(type) ? FromArgument(args, type) : type;
|
|
152269
152975
|
}
|
|
152270
152976
|
function Instantiate(type, args) {
|
|
152271
152977
|
return FromType(args, CloneType(type));
|
|
@@ -152329,7 +153035,7 @@ function FromRest5(T2, M) {
|
|
|
152329
153035
|
return T2.map((L) => Intrinsic(L, M));
|
|
152330
153036
|
}
|
|
152331
153037
|
function Intrinsic(schema, mode, options = {}) {
|
|
152332
|
-
return
|
|
153038
|
+
return IsMappedKey2(schema) ? IntrinsicFromMappedKey(schema, mode, options) : IsTemplateLiteral2(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion2(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral2(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : CreateType(schema, options);
|
|
152333
153039
|
}
|
|
152334
153040
|
|
|
152335
153041
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
|
|
@@ -152387,18 +153093,18 @@ function FromObject3(type, propertyKeys, properties) {
|
|
|
152387
153093
|
return Object2(mappedProperties, options);
|
|
152388
153094
|
}
|
|
152389
153095
|
function UnionFromPropertyKeys(propertyKeys) {
|
|
152390
|
-
const result = propertyKeys.reduce((result2, key) =>
|
|
153096
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue2(key) ? [...result2, Literal(key)] : result2, []);
|
|
152391
153097
|
return Union(result);
|
|
152392
153098
|
}
|
|
152393
153099
|
function OmitResolve(type, propertyKeys) {
|
|
152394
|
-
return
|
|
153100
|
+
return IsIntersect2(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion2(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject4(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
|
|
152395
153101
|
}
|
|
152396
153102
|
function Omit(type, key, options) {
|
|
152397
153103
|
const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
|
|
152398
|
-
const propertyKeys =
|
|
152399
|
-
const isTypeRef =
|
|
152400
|
-
const isKeyRef =
|
|
152401
|
-
return
|
|
153104
|
+
const propertyKeys = IsSchema2(key) ? IndexPropertyKeys(key) : key;
|
|
153105
|
+
const isTypeRef = IsRef2(type);
|
|
153106
|
+
const isKeyRef = IsRef2(key);
|
|
153107
|
+
return IsMappedResult2(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey2(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
|
|
152402
153108
|
}
|
|
152403
153109
|
|
|
152404
153110
|
// ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
|
|
@@ -152453,18 +153159,18 @@ function FromObject4(Type, keys, properties) {
|
|
|
152453
153159
|
return Object2(mappedProperties, options);
|
|
152454
153160
|
}
|
|
152455
153161
|
function UnionFromPropertyKeys2(propertyKeys) {
|
|
152456
|
-
const result = propertyKeys.reduce((result2, key) =>
|
|
153162
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue2(key) ? [...result2, Literal(key)] : result2, []);
|
|
152457
153163
|
return Union(result);
|
|
152458
153164
|
}
|
|
152459
153165
|
function PickResolve(type, propertyKeys) {
|
|
152460
|
-
return
|
|
153166
|
+
return IsIntersect2(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion2(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject4(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
|
|
152461
153167
|
}
|
|
152462
153168
|
function Pick(type, key, options) {
|
|
152463
153169
|
const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
|
|
152464
|
-
const propertyKeys =
|
|
152465
|
-
const isTypeRef =
|
|
152466
|
-
const isKeyRef =
|
|
152467
|
-
return
|
|
153170
|
+
const propertyKeys = IsSchema2(key) ? IndexPropertyKeys(key) : key;
|
|
153171
|
+
const isTypeRef = IsRef2(type);
|
|
153172
|
+
const isKeyRef = IsRef2(key);
|
|
153173
|
+
return IsMappedResult2(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey2(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
|
|
152468
153174
|
}
|
|
152469
153175
|
|
|
152470
153176
|
// ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
|
|
@@ -152508,10 +153214,10 @@ function FromRest6(types) {
|
|
|
152508
153214
|
return types.map((type) => PartialResolve(type));
|
|
152509
153215
|
}
|
|
152510
153216
|
function PartialResolve(type) {
|
|
152511
|
-
return
|
|
153217
|
+
return IsComputed2(type) ? FromComputed3(type.target, type.parameters) : IsRef2(type) ? FromRef3(type.$ref) : IsIntersect2(type) ? Intersect(FromRest6(type.allOf)) : IsUnion2(type) ? Union(FromRest6(type.anyOf)) : IsObject4(type) ? FromObject5(type, type.properties) : IsBigInt4(type) ? type : IsBoolean4(type) ? type : IsInteger3(type) ? type : IsLiteral2(type) ? type : IsNull4(type) ? type : IsNumber4(type) ? type : IsString4(type) ? type : IsSymbol4(type) ? type : IsUndefined4(type) ? type : Object2({});
|
|
152512
153218
|
}
|
|
152513
153219
|
function Partial(type, options) {
|
|
152514
|
-
if (
|
|
153220
|
+
if (IsMappedResult2(type)) {
|
|
152515
153221
|
return PartialFromMappedResult(type, options);
|
|
152516
153222
|
} else {
|
|
152517
153223
|
return CreateType({ ...PartialResolve(type), ...options });
|
|
@@ -152555,10 +153261,10 @@ function FromRest7(types) {
|
|
|
152555
153261
|
return types.map((type) => RequiredResolve(type));
|
|
152556
153262
|
}
|
|
152557
153263
|
function RequiredResolve(type) {
|
|
152558
|
-
return
|
|
153264
|
+
return IsComputed2(type) ? FromComputed4(type.target, type.parameters) : IsRef2(type) ? FromRef4(type.$ref) : IsIntersect2(type) ? Intersect(FromRest7(type.allOf)) : IsUnion2(type) ? Union(FromRest7(type.anyOf)) : IsObject4(type) ? FromObject6(type, type.properties) : IsBigInt4(type) ? type : IsBoolean4(type) ? type : IsInteger3(type) ? type : IsLiteral2(type) ? type : IsNull4(type) ? type : IsNumber4(type) ? type : IsString4(type) ? type : IsSymbol4(type) ? type : IsUndefined4(type) ? type : Object2({});
|
|
152559
153265
|
}
|
|
152560
153266
|
function Required(type, options) {
|
|
152561
|
-
if (
|
|
153267
|
+
if (IsMappedResult2(type)) {
|
|
152562
153268
|
return RequiredFromMappedResult(type, options);
|
|
152563
153269
|
} else {
|
|
152564
153270
|
return CreateType({ ...RequiredResolve(type), ...options });
|
|
@@ -152583,11 +153289,11 @@ function RequiredFromMappedResult(R, options) {
|
|
|
152583
153289
|
// ../../node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
|
|
152584
153290
|
function DereferenceParameters(moduleProperties, types) {
|
|
152585
153291
|
return types.map((type) => {
|
|
152586
|
-
return
|
|
153292
|
+
return IsRef2(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
|
|
152587
153293
|
});
|
|
152588
153294
|
}
|
|
152589
153295
|
function Dereference(moduleProperties, ref) {
|
|
152590
|
-
return ref in moduleProperties ?
|
|
153296
|
+
return ref in moduleProperties ? IsRef2(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
|
|
152591
153297
|
}
|
|
152592
153298
|
function FromAwaited(parameters) {
|
|
152593
153299
|
return Awaited(parameters[0]);
|
|
@@ -152644,7 +153350,7 @@ function FromRecord3(moduleProperties, type) {
|
|
|
152644
153350
|
return result;
|
|
152645
153351
|
}
|
|
152646
153352
|
function FromTransform(moduleProperties, transform) {
|
|
152647
|
-
return
|
|
153353
|
+
return IsRef2(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
|
|
152648
153354
|
}
|
|
152649
153355
|
function FromTuple5(moduleProperties, types) {
|
|
152650
153356
|
return Tuple(FromTypes2(moduleProperties, types));
|
|
@@ -152656,7 +153362,7 @@ function FromTypes2(moduleProperties, types) {
|
|
|
152656
153362
|
return types.map((type) => FromType2(moduleProperties, type));
|
|
152657
153363
|
}
|
|
152658
153364
|
function FromType2(moduleProperties, type) {
|
|
152659
|
-
return
|
|
153365
|
+
return IsOptional2(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly2(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : IsTransform2(type) ? CreateType(FromTransform(moduleProperties, type), type) : IsArray4(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator4(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed2(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor2(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction4(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect2(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator4(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject4(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord2(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple2(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion2(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type;
|
|
152660
153366
|
}
|
|
152661
153367
|
function ComputeType(moduleProperties, key) {
|
|
152662
153368
|
return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
|
|
@@ -152695,7 +153401,7 @@ function Not2(type, options) {
|
|
|
152695
153401
|
|
|
152696
153402
|
// ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
|
|
152697
153403
|
function Parameters(schema, options) {
|
|
152698
|
-
return
|
|
153404
|
+
return IsFunction4(schema) ? Tuple(schema.parameters, options) : Never();
|
|
152699
153405
|
}
|
|
152700
153406
|
|
|
152701
153407
|
// ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
|
|
@@ -152716,7 +153422,7 @@ function RegExp2(unresolved, options) {
|
|
|
152716
153422
|
|
|
152717
153423
|
// ../../node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
|
|
152718
153424
|
function RestResolve(T2) {
|
|
152719
|
-
return
|
|
153425
|
+
return IsIntersect2(T2) ? T2.allOf : IsUnion2(T2) ? T2.anyOf : IsTuple2(T2) ? T2.items ?? [] : [];
|
|
152720
153426
|
}
|
|
152721
153427
|
function Rest(T2) {
|
|
152722
153428
|
return RestResolve(T2);
|
|
@@ -152724,7 +153430,7 @@ function Rest(T2) {
|
|
|
152724
153430
|
|
|
152725
153431
|
// ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
|
|
152726
153432
|
function ReturnType(schema, options) {
|
|
152727
|
-
return
|
|
153433
|
+
return IsFunction4(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
152728
153434
|
}
|
|
152729
153435
|
|
|
152730
153436
|
// ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
|
|
@@ -152753,7 +153459,7 @@ class TransformEncodeBuilder {
|
|
|
152753
153459
|
return { ...schema, [TransformKind]: Codec };
|
|
152754
153460
|
}
|
|
152755
153461
|
Encode(encode) {
|
|
152756
|
-
return
|
|
153462
|
+
return IsTransform2(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
|
|
152757
153463
|
}
|
|
152758
153464
|
}
|
|
152759
153465
|
function Transform(schema) {
|
|
@@ -153278,7 +153984,7 @@ function FromIntersect9(schema, references, value) {
|
|
|
153278
153984
|
const keyPattern = new RegExp(KeyOfPattern(schema));
|
|
153279
153985
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
|
|
153280
153986
|
return check1 && check2;
|
|
153281
|
-
} else if (
|
|
153987
|
+
} else if (IsSchema2(schema.unevaluatedProperties)) {
|
|
153282
153988
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
153283
153989
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit5(schema.unevaluatedProperties, references, value[key]));
|
|
153284
153990
|
return check1 && check2;
|
|
@@ -154803,7 +155509,7 @@ function Cast(...args) {
|
|
|
154803
155509
|
}
|
|
154804
155510
|
// ../../node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs
|
|
154805
155511
|
function IsCheckable(schema) {
|
|
154806
|
-
return
|
|
155512
|
+
return IsKind2(schema) && schema[Kind] !== "Unsafe";
|
|
154807
155513
|
}
|
|
154808
155514
|
function FromArray12(schema, references, value) {
|
|
154809
155515
|
if (!IsArray2(value))
|
|
@@ -154819,7 +155525,7 @@ function FromIntersect13(schema, references, value) {
|
|
|
154819
155525
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
154820
155526
|
const intersections = schema.allOf.map((schema2) => Visit9(schema2, references, Clone2(value)));
|
|
154821
155527
|
const composite = intersections.reduce((acc, value2) => IsObject2(value2) ? { ...acc, ...value2 } : value2, {});
|
|
154822
|
-
if (!IsObject2(value) || !IsObject2(composite) || !
|
|
155528
|
+
if (!IsObject2(value) || !IsObject2(composite) || !IsKind2(unevaluatedProperties))
|
|
154823
155529
|
return composite;
|
|
154824
155530
|
const knownkeys = KeyOfPropertyKeys(schema);
|
|
154825
155531
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
@@ -154840,7 +155546,7 @@ function FromObject13(schema, references, value) {
|
|
|
154840
155546
|
value[key] = Visit9(schema.properties[key], references, value[key]);
|
|
154841
155547
|
continue;
|
|
154842
155548
|
}
|
|
154843
|
-
if (
|
|
155549
|
+
if (IsKind2(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
154844
155550
|
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
154845
155551
|
continue;
|
|
154846
155552
|
}
|
|
@@ -154860,7 +155566,7 @@ function FromRecord8(schema, references, value) {
|
|
|
154860
155566
|
value[key] = Visit9(propertySchema, references, value[key]);
|
|
154861
155567
|
continue;
|
|
154862
155568
|
}
|
|
154863
|
-
if (
|
|
155569
|
+
if (IsKind2(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
154864
155570
|
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
154865
155571
|
continue;
|
|
154866
155572
|
}
|
|
@@ -155154,7 +155860,7 @@ class TransformDecodeError extends TypeBoxError {
|
|
|
155154
155860
|
}
|
|
155155
155861
|
function Default3(schema, path6, value) {
|
|
155156
155862
|
try {
|
|
155157
|
-
return
|
|
155863
|
+
return IsTransform2(schema) ? schema[TransformKind].Decode(value) : value;
|
|
155158
155864
|
} catch (error) {
|
|
155159
155865
|
throw new TransformDecodeError(schema, path6, value, error);
|
|
155160
155866
|
}
|
|
@@ -155172,7 +155878,7 @@ function FromIntersect15(schema, references, path6, value) {
|
|
|
155172
155878
|
if (knownKey in knownProperties) {
|
|
155173
155879
|
knownProperties[knownKey] = Visit11(knownSchema, references, `${path6}/${knownKey}`, knownProperties[knownKey]);
|
|
155174
155880
|
}
|
|
155175
|
-
if (!
|
|
155881
|
+
if (!IsTransform2(schema.unevaluatedProperties)) {
|
|
155176
155882
|
return Default3(schema, path6, knownProperties);
|
|
155177
155883
|
}
|
|
155178
155884
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155201,11 +155907,11 @@ function FromObject15(schema, references, path6, value) {
|
|
|
155201
155907
|
for (const key of knownKeys) {
|
|
155202
155908
|
if (!HasPropertyKey2(knownProperties, key))
|
|
155203
155909
|
continue;
|
|
155204
|
-
if (IsUndefined2(knownProperties[key]) && (!
|
|
155910
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined4(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
155205
155911
|
continue;
|
|
155206
155912
|
knownProperties[key] = Visit11(schema.properties[key], references, `${path6}/${key}`, knownProperties[key]);
|
|
155207
155913
|
}
|
|
155208
|
-
if (!
|
|
155914
|
+
if (!IsSchema2(schema.additionalProperties)) {
|
|
155209
155915
|
return Default3(schema, path6, knownProperties);
|
|
155210
155916
|
}
|
|
155211
155917
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155227,7 +155933,7 @@ function FromRecord10(schema, references, path6, value) {
|
|
|
155227
155933
|
if (knownKeys.test(key)) {
|
|
155228
155934
|
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path6}/${key}`, knownProperties[key]);
|
|
155229
155935
|
}
|
|
155230
|
-
if (!
|
|
155936
|
+
if (!IsSchema2(schema.additionalProperties)) {
|
|
155231
155937
|
return Default3(schema, path6, knownProperties);
|
|
155232
155938
|
}
|
|
155233
155939
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155314,7 +156020,7 @@ class TransformEncodeError extends TypeBoxError {
|
|
|
155314
156020
|
}
|
|
155315
156021
|
function Default4(schema, path6, value) {
|
|
155316
156022
|
try {
|
|
155317
|
-
return
|
|
156023
|
+
return IsTransform2(schema) ? schema[TransformKind].Encode(value) : value;
|
|
155318
156024
|
} catch (error) {
|
|
155319
156025
|
throw new TransformEncodeError(schema, path6, value, error);
|
|
155320
156026
|
}
|
|
@@ -155340,7 +156046,7 @@ function FromIntersect16(schema, references, path6, value) {
|
|
|
155340
156046
|
if (knownKey in knownProperties) {
|
|
155341
156047
|
knownProperties[knownKey] = Visit12(knownSchema, references, `${path6}/${knownKey}`, knownProperties[knownKey]);
|
|
155342
156048
|
}
|
|
155343
|
-
if (!
|
|
156049
|
+
if (!IsTransform2(schema.unevaluatedProperties)) {
|
|
155344
156050
|
return knownProperties;
|
|
155345
156051
|
}
|
|
155346
156052
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155364,11 +156070,11 @@ function FromObject16(schema, references, path6, value) {
|
|
|
155364
156070
|
for (const key of knownKeys) {
|
|
155365
156071
|
if (!HasPropertyKey2(knownProperties, key))
|
|
155366
156072
|
continue;
|
|
155367
|
-
if (IsUndefined2(knownProperties[key]) && (!
|
|
156073
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined4(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
155368
156074
|
continue;
|
|
155369
156075
|
knownProperties[key] = Visit12(schema.properties[key], references, `${path6}/${key}`, knownProperties[key]);
|
|
155370
156076
|
}
|
|
155371
|
-
if (!
|
|
156077
|
+
if (!IsSchema2(schema.additionalProperties)) {
|
|
155372
156078
|
return knownProperties;
|
|
155373
156079
|
}
|
|
155374
156080
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155391,7 +156097,7 @@ function FromRecord11(schema, references, path6, value) {
|
|
|
155391
156097
|
if (knownKeys.test(key)) {
|
|
155392
156098
|
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path6}/${key}`, knownProperties[key]);
|
|
155393
156099
|
}
|
|
155394
|
-
if (!
|
|
156100
|
+
if (!IsSchema2(schema.additionalProperties)) {
|
|
155395
156101
|
return knownProperties;
|
|
155396
156102
|
}
|
|
155397
156103
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155466,57 +156172,57 @@ function TransformEncode(schema, references, value) {
|
|
|
155466
156172
|
|
|
155467
156173
|
// ../../node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
155468
156174
|
function FromArray16(schema, references) {
|
|
155469
|
-
return
|
|
156175
|
+
return IsTransform2(schema) || Visit13(schema.items, references);
|
|
155470
156176
|
}
|
|
155471
156177
|
function FromAsyncIterator7(schema, references) {
|
|
155472
|
-
return
|
|
156178
|
+
return IsTransform2(schema) || Visit13(schema.items, references);
|
|
155473
156179
|
}
|
|
155474
156180
|
function FromConstructor8(schema, references) {
|
|
155475
|
-
return
|
|
156181
|
+
return IsTransform2(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
155476
156182
|
}
|
|
155477
156183
|
function FromFunction7(schema, references) {
|
|
155478
|
-
return
|
|
156184
|
+
return IsTransform2(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
155479
156185
|
}
|
|
155480
156186
|
function FromIntersect17(schema, references) {
|
|
155481
|
-
return
|
|
156187
|
+
return IsTransform2(schema) || IsTransform2(schema.unevaluatedProperties) || schema.allOf.some((schema2) => Visit13(schema2, references));
|
|
155482
156188
|
}
|
|
155483
156189
|
function FromImport9(schema, references) {
|
|
155484
156190
|
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
155485
156191
|
const target = schema.$defs[schema.$ref];
|
|
155486
|
-
return
|
|
156192
|
+
return IsTransform2(schema) || Visit13(target, [...additional, ...references]);
|
|
155487
156193
|
}
|
|
155488
156194
|
function FromIterator7(schema, references) {
|
|
155489
|
-
return
|
|
156195
|
+
return IsTransform2(schema) || Visit13(schema.items, references);
|
|
155490
156196
|
}
|
|
155491
156197
|
function FromNot7(schema, references) {
|
|
155492
|
-
return
|
|
156198
|
+
return IsTransform2(schema) || Visit13(schema.not, references);
|
|
155493
156199
|
}
|
|
155494
156200
|
function FromObject17(schema, references) {
|
|
155495
|
-
return
|
|
156201
|
+
return IsTransform2(schema) || Object.values(schema.properties).some((schema2) => Visit13(schema2, references)) || IsSchema2(schema.additionalProperties) && Visit13(schema.additionalProperties, references);
|
|
155496
156202
|
}
|
|
155497
156203
|
function FromPromise7(schema, references) {
|
|
155498
|
-
return
|
|
156204
|
+
return IsTransform2(schema) || Visit13(schema.item, references);
|
|
155499
156205
|
}
|
|
155500
156206
|
function FromRecord12(schema, references) {
|
|
155501
156207
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
155502
156208
|
const property = schema.patternProperties[pattern];
|
|
155503
|
-
return
|
|
156209
|
+
return IsTransform2(schema) || Visit13(property, references) || IsSchema2(schema.additionalProperties) && IsTransform2(schema.additionalProperties);
|
|
155504
156210
|
}
|
|
155505
156211
|
function FromRef13(schema, references) {
|
|
155506
|
-
if (
|
|
156212
|
+
if (IsTransform2(schema))
|
|
155507
156213
|
return true;
|
|
155508
156214
|
return Visit13(Deref(schema, references), references);
|
|
155509
156215
|
}
|
|
155510
156216
|
function FromThis9(schema, references) {
|
|
155511
|
-
if (
|
|
156217
|
+
if (IsTransform2(schema))
|
|
155512
156218
|
return true;
|
|
155513
156219
|
return Visit13(Deref(schema, references), references);
|
|
155514
156220
|
}
|
|
155515
156221
|
function FromTuple14(schema, references) {
|
|
155516
|
-
return
|
|
156222
|
+
return IsTransform2(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) => Visit13(schema2, references));
|
|
155517
156223
|
}
|
|
155518
156224
|
function FromUnion19(schema, references) {
|
|
155519
|
-
return
|
|
156225
|
+
return IsTransform2(schema) || schema.anyOf.some((schema2) => Visit13(schema2, references));
|
|
155520
156226
|
}
|
|
155521
156227
|
function Visit13(schema, references) {
|
|
155522
156228
|
const references_ = Pushref(schema, references);
|
|
@@ -155557,7 +156263,7 @@ function Visit13(schema, references) {
|
|
|
155557
156263
|
case "Union":
|
|
155558
156264
|
return FromUnion19(schema_, references_);
|
|
155559
156265
|
default:
|
|
155560
|
-
return
|
|
156266
|
+
return IsTransform2(schema);
|
|
155561
156267
|
}
|
|
155562
156268
|
}
|
|
155563
156269
|
var visited = new Set;
|
|
@@ -155580,7 +156286,7 @@ function ValueOrDefault(schema, value) {
|
|
|
155580
156286
|
return IsUndefined2(value) ? clone : IsObject2(value) && IsObject2(clone) ? Object.assign(clone, value) : value;
|
|
155581
156287
|
}
|
|
155582
156288
|
function HasDefaultProperty(schema) {
|
|
155583
|
-
return
|
|
156289
|
+
return IsKind2(schema) && "default" in schema;
|
|
155584
156290
|
}
|
|
155585
156291
|
function FromArray17(schema, references, value) {
|
|
155586
156292
|
if (IsArray2(value)) {
|
|
@@ -156318,8 +157024,8 @@ var TypeCompiler;
|
|
|
156318
157024
|
yield `${value}.length >= ${schema.minItems}`;
|
|
156319
157025
|
const elementExpression = CreateExpression(schema.items, references, "value");
|
|
156320
157026
|
yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`;
|
|
156321
|
-
if (
|
|
156322
|
-
const containsSchema =
|
|
157027
|
+
if (IsSchema(schema.contains) || IsNumber2(schema.minContains) || IsNumber2(schema.maxContains)) {
|
|
157028
|
+
const containsSchema = IsSchema(schema.contains) ? schema.contains : Never();
|
|
156323
157029
|
const checkExpression = CreateExpression(containsSchema, references, "value");
|
|
156324
157030
|
const checkMinContains = IsNumber2(schema.minContains) ? [`(count >= ${schema.minContains})`] : [];
|
|
156325
157031
|
const checkMaxContains = IsNumber2(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : [];
|
|
@@ -156396,7 +157102,7 @@ var TypeCompiler;
|
|
|
156396
157102
|
const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`);
|
|
156397
157103
|
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key))`;
|
|
156398
157104
|
yield `(${check1} && ${check2})`;
|
|
156399
|
-
} else if (
|
|
157105
|
+
} else if (IsSchema(schema.unevaluatedProperties)) {
|
|
156400
157106
|
const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`);
|
|
156401
157107
|
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key) || ${CreateExpression(schema.unevaluatedProperties, references, `${value}[key]`)})`;
|
|
156402
157108
|
yield `(${check1} && ${check2})`;
|
|
@@ -156482,7 +157188,7 @@ var TypeCompiler;
|
|
|
156482
157188
|
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
156483
157189
|
const variable = CreateVariable(`${new RegExp(patternKey)}`);
|
|
156484
157190
|
const check1 = CreateExpression(patternSchema, references, "value");
|
|
156485
|
-
const check2 =
|
|
157191
|
+
const check2 = IsSchema(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? "false" : "true";
|
|
156486
157192
|
const expression = `(${variable}.test(key) ? ${check1} : ${check2})`;
|
|
156487
157193
|
yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`;
|
|
156488
157194
|
}
|
|
@@ -156700,10 +157406,10 @@ var TypeCompiler;
|
|
|
156700
157406
|
state.variables.clear();
|
|
156701
157407
|
state.functions.clear();
|
|
156702
157408
|
state.instances.clear();
|
|
156703
|
-
if (!
|
|
157409
|
+
if (!IsSchema(schema))
|
|
156704
157410
|
throw new TypeCompilerTypeGuardError(schema);
|
|
156705
157411
|
for (const schema2 of references)
|
|
156706
|
-
if (!
|
|
157412
|
+
if (!IsSchema(schema2))
|
|
156707
157413
|
throw new TypeCompilerTypeGuardError(schema2);
|
|
156708
157414
|
return Build(schema, references, options);
|
|
156709
157415
|
}
|
|
@@ -173418,438 +174124,7 @@ class GetAnalyticsTool {
|
|
|
173418
174124
|
}
|
|
173419
174125
|
// ../../packages/core/dist/tools/get_optimized_context.js
|
|
173420
174126
|
init_dist();
|
|
173421
|
-
|
|
173422
|
-
// ../../packages/core/dist/controllers/context-controller.js
|
|
173423
|
-
init_dist();
|
|
173424
|
-
init_search_controller();
|
|
173425
|
-
init_memory_controller();
|
|
173426
|
-
|
|
173427
|
-
// ../../packages/core/dist/tools/compress_context.js
|
|
173428
|
-
init_code_compressor();
|
|
173429
|
-
init_dist();
|
|
173430
|
-
init_dist();
|
|
173431
|
-
init_enum_validation();
|
|
173432
|
-
|
|
173433
|
-
class CompressContextTool {
|
|
173434
|
-
name = "compress_context";
|
|
173435
|
-
description = "Compress context using semantic compression (keeps structure, removes details)";
|
|
173436
|
-
inputSchema = {
|
|
173437
|
-
type: "object",
|
|
173438
|
-
properties: {
|
|
173439
|
-
content: {
|
|
173440
|
-
type: "string",
|
|
173441
|
-
description: "Content to compress"
|
|
173442
|
-
},
|
|
173443
|
-
strategy: {
|
|
173444
|
-
type: "string",
|
|
173445
|
-
enum: [
|
|
173446
|
-
"code_structure",
|
|
173447
|
-
"conversation_summary",
|
|
173448
|
-
"semantic_dedup",
|
|
173449
|
-
"hierarchical"
|
|
173450
|
-
],
|
|
173451
|
-
description: "Compression strategy",
|
|
173452
|
-
default: "code_structure"
|
|
173453
|
-
},
|
|
173454
|
-
language: {
|
|
173455
|
-
type: "string",
|
|
173456
|
-
description: "Programming language (for code compression)"
|
|
173457
|
-
},
|
|
173458
|
-
targetRatio: {
|
|
173459
|
-
type: "number",
|
|
173460
|
-
description: "Target compression ratio (0-1, e.g., 0.7 = 70% reduction)",
|
|
173461
|
-
default: 0.7
|
|
173462
|
-
}
|
|
173463
|
-
},
|
|
173464
|
-
required: ["content"]
|
|
173465
|
-
};
|
|
173466
|
-
compressor;
|
|
173467
|
-
constructor() {
|
|
173468
|
-
this.compressor = new CodeCompressor;
|
|
173469
|
-
}
|
|
173470
|
-
async handle(params) {
|
|
173471
|
-
const { content, language, targetRatio = 0.7 } = params;
|
|
173472
|
-
const strategy = validateEnum("strategy", params.strategy ?? "code_structure", [
|
|
173473
|
-
"code_structure",
|
|
173474
|
-
"conversation_summary",
|
|
173475
|
-
"semantic_dedup",
|
|
173476
|
-
"hierarchical"
|
|
173477
|
-
]);
|
|
173478
|
-
try {
|
|
173479
|
-
const originalTokens = estimateTokens(content, language || "code");
|
|
173480
|
-
logger.info("Compressing context", {
|
|
173481
|
-
originalTokens,
|
|
173482
|
-
strategy,
|
|
173483
|
-
targetRatio
|
|
173484
|
-
});
|
|
173485
|
-
const result = await this.compressor.compress(content, strategy);
|
|
173486
|
-
const compressedTokens = estimateTokens(result.compressed, language || "code");
|
|
173487
|
-
const actualRatio = 1 - compressedTokens / originalTokens;
|
|
173488
|
-
const tokensSaved = originalTokens - compressedTokens;
|
|
173489
|
-
logger.info("Context compressed", {
|
|
173490
|
-
originalTokens,
|
|
173491
|
-
compressedTokens,
|
|
173492
|
-
tokensSaved,
|
|
173493
|
-
actualRatio: actualRatio.toFixed(2),
|
|
173494
|
-
targetRatio
|
|
173495
|
-
});
|
|
173496
|
-
return {
|
|
173497
|
-
success: true,
|
|
173498
|
-
data: {
|
|
173499
|
-
compressed: result.compressed,
|
|
173500
|
-
originalLength: content.length,
|
|
173501
|
-
compressedLength: result.compressed.length,
|
|
173502
|
-
originalTokens,
|
|
173503
|
-
compressedTokens,
|
|
173504
|
-
strategy
|
|
173505
|
-
},
|
|
173506
|
-
metadata: {
|
|
173507
|
-
tokensSaved,
|
|
173508
|
-
compressionRatio: actualRatio
|
|
173509
|
-
}
|
|
173510
|
-
};
|
|
173511
|
-
} catch (error51) {
|
|
173512
|
-
logger.error("Failed to compress context", error51, {
|
|
173513
|
-
strategy,
|
|
173514
|
-
contentLength: typeof content === "string" ? content.length : 0
|
|
173515
|
-
});
|
|
173516
|
-
return {
|
|
173517
|
-
success: false,
|
|
173518
|
-
error: `Failed to compress context: ${error51.message}`
|
|
173519
|
-
};
|
|
173520
|
-
}
|
|
173521
|
-
}
|
|
173522
|
-
}
|
|
173523
|
-
|
|
173524
|
-
// ../../packages/core/dist/controllers/context-controller.js
|
|
173525
|
-
init_session_file_cache();
|
|
173526
|
-
init_symbol_graph_service();
|
|
173527
|
-
init_token_metrics();
|
|
173528
|
-
|
|
173529
|
-
class ContextController {
|
|
173530
|
-
static instance = null;
|
|
173531
|
-
searchCtrl;
|
|
173532
|
-
memoryCtrl;
|
|
173533
|
-
compressor;
|
|
173534
|
-
sessionCache;
|
|
173535
|
-
constructor() {
|
|
173536
|
-
this.searchCtrl = SearchController.getInstance();
|
|
173537
|
-
this.memoryCtrl = MemoryController.getInstance();
|
|
173538
|
-
this.compressor = new CompressContextTool;
|
|
173539
|
-
this.sessionCache = SessionFileCache.getInstance();
|
|
173540
|
-
}
|
|
173541
|
-
static getInstance() {
|
|
173542
|
-
if (!ContextController.instance) {
|
|
173543
|
-
ContextController.instance = new ContextController;
|
|
173544
|
-
}
|
|
173545
|
-
return ContextController.instance;
|
|
173546
|
-
}
|
|
173547
|
-
async getOptimizedContext(input) {
|
|
173548
|
-
const { query, projectId, projectPath: projectPath2, maxTokens = 4000, maxResults = 5, workingMemoryBudget, userId, sessionId, includeMemories = true, memoryBudgetRatio = 0.2 } = input;
|
|
173549
|
-
const clampedRatio = Math.max(0, Math.min(0.5, memoryBudgetRatio));
|
|
173550
|
-
const memoryTokenBudget = includeMemories ? Math.floor(maxTokens * clampedRatio) : 0;
|
|
173551
|
-
const codeTokenBudget = maxTokens - memoryTokenBudget;
|
|
173552
|
-
const wmBudget = workingMemoryBudget || Math.floor(codeTokenBudget * 0.8);
|
|
173553
|
-
logger.info("Getting optimized context", {
|
|
173554
|
-
query: query.slice(0, 50),
|
|
173555
|
-
projectId,
|
|
173556
|
-
maxTokens,
|
|
173557
|
-
includeMemories,
|
|
173558
|
-
memoryTokenBudget,
|
|
173559
|
-
codeTokenBudget,
|
|
173560
|
-
workingMemoryBudget: wmBudget
|
|
173561
|
-
});
|
|
173562
|
-
let graphContextSection = "";
|
|
173563
|
-
let graphBoostFiles = [];
|
|
173564
|
-
if (projectId && await symbolGraphService.hasData(projectId) && looksLikeSymbol(query)) {
|
|
173565
|
-
try {
|
|
173566
|
-
const [defs, refs] = await Promise.all([
|
|
173567
|
-
symbolGraphService.goToDefinition(projectId, query),
|
|
173568
|
-
symbolGraphService.getReferences(projectId, query)
|
|
173569
|
-
]);
|
|
173570
|
-
if (defs.length > 0) {
|
|
173571
|
-
const graphTokenBudget = Math.floor(codeTokenBudget * 0.2);
|
|
173572
|
-
graphContextSection = formatGraphContext(defs, refs, graphTokenBudget);
|
|
173573
|
-
graphBoostFiles = [
|
|
173574
|
-
...new Set([
|
|
173575
|
-
...defs.map((d) => d.file),
|
|
173576
|
-
...refs.slice(0, 10).map((r2) => r2.fromFile)
|
|
173577
|
-
])
|
|
173578
|
-
];
|
|
173579
|
-
logger.debug("Graph prefilter hit", {
|
|
173580
|
-
query,
|
|
173581
|
-
defs: defs.length,
|
|
173582
|
-
refs: refs.length,
|
|
173583
|
-
boostFiles: graphBoostFiles.length
|
|
173584
|
-
});
|
|
173585
|
-
}
|
|
173586
|
-
} catch (err) {
|
|
173587
|
-
logger.warn("Graph prefilter failed", { query, error: err.message });
|
|
173588
|
-
}
|
|
173589
|
-
}
|
|
173590
|
-
const [searchResult, memories] = await Promise.all([
|
|
173591
|
-
this.searchCtrl.searchProject({
|
|
173592
|
-
query,
|
|
173593
|
-
projectId,
|
|
173594
|
-
projectPath: projectPath2,
|
|
173595
|
-
maxResults,
|
|
173596
|
-
responseMode: "full",
|
|
173597
|
-
autoReindex: false,
|
|
173598
|
-
minScore: 0.4,
|
|
173599
|
-
boostFiles: graphBoostFiles.length > 0 ? graphBoostFiles : undefined
|
|
173600
|
-
}),
|
|
173601
|
-
includeMemories ? this.searchMemoriesSafe(query, {
|
|
173602
|
-
projectId,
|
|
173603
|
-
userId,
|
|
173604
|
-
sessionId,
|
|
173605
|
-
limit: 5
|
|
173606
|
-
}) : Promise.resolve([])
|
|
173607
|
-
]);
|
|
173608
|
-
const codeResults = searchResult.results;
|
|
173609
|
-
const workingSet = this.selectWorkingSet(codeResults, wmBudget);
|
|
173610
|
-
const memorySection = this.formatMemorySection(memories, memoryTokenBudget);
|
|
173611
|
-
if (workingSet.length === 0 && memories.length === 0) {
|
|
173612
|
-
return {
|
|
173613
|
-
context: `No relevant code or memories found for query: "${query}"`,
|
|
173614
|
-
sources: [],
|
|
173615
|
-
resultsCount: 0,
|
|
173616
|
-
memoriesCount: 0,
|
|
173617
|
-
tokensSaved: 0,
|
|
173618
|
-
compressionRatio: 0,
|
|
173619
|
-
sessionCacheHits: 0,
|
|
173620
|
-
tokensSavedBySessionCache: 0
|
|
173621
|
-
};
|
|
173622
|
-
}
|
|
173623
|
-
let sessionCacheHits = 0;
|
|
173624
|
-
let tokensSavedBySessionCache = 0;
|
|
173625
|
-
const deliveryPlan = workingSet.map((r2) => {
|
|
173626
|
-
if (!sessionId) {
|
|
173627
|
-
return { result: r2, kind: "full", tokensSaved: 0 };
|
|
173628
|
-
}
|
|
173629
|
-
const content = r2.content || r2.preview || "";
|
|
173630
|
-
const key = this.sessionCache.chunkKey(r2.filePath || "unknown", r2.lineStart ?? 0, r2.lineEnd ?? 0);
|
|
173631
|
-
const check3 = this.sessionCache.check(sessionId, key, content);
|
|
173632
|
-
if (check3.status === "unchanged") {
|
|
173633
|
-
sessionCacheHits++;
|
|
173634
|
-
tokensSavedBySessionCache += check3.tokensSaved;
|
|
173635
|
-
return { result: r2, kind: "ref", tokensSaved: check3.tokensSaved };
|
|
173636
|
-
}
|
|
173637
|
-
if (check3.status === "changed" && check3.diff !== undefined) {
|
|
173638
|
-
sessionCacheHits++;
|
|
173639
|
-
tokensSavedBySessionCache += check3.tokensSaved;
|
|
173640
|
-
return { result: r2, kind: "diff", diff: check3.diff, tokensSaved: check3.tokensSaved };
|
|
173641
|
-
}
|
|
173642
|
-
return { result: r2, kind: "full", tokensSaved: 0 };
|
|
173643
|
-
});
|
|
173644
|
-
const parts = [`# Context for: ${query}
|
|
173645
|
-
`];
|
|
173646
|
-
if (graphContextSection) {
|
|
173647
|
-
parts.push(graphContextSection, "");
|
|
173648
|
-
}
|
|
173649
|
-
if (memorySection) {
|
|
173650
|
-
parts.push(memorySection, "");
|
|
173651
|
-
}
|
|
173652
|
-
if (deliveryPlan.length > 0) {
|
|
173653
|
-
const fullCount = deliveryPlan.filter((d) => d.kind === "full").length;
|
|
173654
|
-
const refCount = deliveryPlan.filter((d) => d.kind === "ref").length;
|
|
173655
|
-
const diffCount = deliveryPlan.filter((d) => d.kind === "diff").length;
|
|
173656
|
-
parts.push(`## Code (${deliveryPlan.length} sections \u2014 ${fullCount} full, ${refCount} cached, ${diffCount} diff | WM budget: ${wmBudget} tokens)
|
|
173657
|
-
`);
|
|
173658
|
-
deliveryPlan.forEach(({ result: r2, kind, diff }, idx) => {
|
|
173659
|
-
const filePath = r2.filePath || "Unknown";
|
|
173660
|
-
const scoreLabel = (r2.score * 100).toFixed(1);
|
|
173661
|
-
const lineRange = `${r2.lineStart ?? "?"}-${r2.lineEnd ?? "?"}`;
|
|
173662
|
-
parts.push(`### ${idx + 1}. ${filePath} (score: ${scoreLabel}%)`);
|
|
173663
|
-
parts.push(`Lines ${lineRange}
|
|
173664
|
-
`);
|
|
173665
|
-
if (kind === "ref") {
|
|
173666
|
-
parts.push(`[CACHED: ${filePath}:${lineRange}]
|
|
173667
|
-
`);
|
|
173668
|
-
} else if (kind === "diff" && diff) {
|
|
173669
|
-
parts.push("```diff");
|
|
173670
|
-
parts.push(diff);
|
|
173671
|
-
parts.push("```\n");
|
|
173672
|
-
} else {
|
|
173673
|
-
parts.push("```" + (r2.language || ""));
|
|
173674
|
-
parts.push(r2.content || r2.preview || "(no content)");
|
|
173675
|
-
parts.push("```\n");
|
|
173676
|
-
}
|
|
173677
|
-
});
|
|
173678
|
-
}
|
|
173679
|
-
const rawContext = parts.join(`
|
|
173680
|
-
`);
|
|
173681
|
-
const rawTokens = estimateTokens(rawContext, "code");
|
|
173682
|
-
let finalContext = rawContext;
|
|
173683
|
-
let compressionRatio = 0;
|
|
173684
|
-
let tokensSaved = 0;
|
|
173685
|
-
if (rawTokens > maxTokens) {
|
|
173686
|
-
logger.info("Context exceeds maxTokens, compressing", {
|
|
173687
|
-
rawTokens,
|
|
173688
|
-
maxTokens
|
|
173689
|
-
});
|
|
173690
|
-
const resp = await this.compressor.handle({
|
|
173691
|
-
content: rawContext,
|
|
173692
|
-
strategy: "code_structure",
|
|
173693
|
-
targetRatio: 0.6
|
|
173694
|
-
});
|
|
173695
|
-
if (resp.success && resp.data) {
|
|
173696
|
-
finalContext = resp.data.compressed;
|
|
173697
|
-
compressionRatio = resp.metadata?.compressionRatio || 0;
|
|
173698
|
-
tokensSaved = resp.metadata?.tokensSaved || 0;
|
|
173699
|
-
}
|
|
173700
|
-
}
|
|
173701
|
-
const finalTokens = estimateTokens(finalContext, "code");
|
|
173702
|
-
const totalTokensSaved = rawTokens - finalTokens;
|
|
173703
|
-
const compressionSavings = tokensSaved;
|
|
173704
|
-
TokenMetrics.getInstance().recordContextRequest(rawTokens, finalTokens, tokensSavedBySessionCache, compressionSavings);
|
|
173705
|
-
logger.info("Optimized context retrieved", {
|
|
173706
|
-
rawTokens,
|
|
173707
|
-
finalTokens,
|
|
173708
|
-
tokensSaved: totalTokensSaved,
|
|
173709
|
-
compressionRatio,
|
|
173710
|
-
codeSources: workingSet.length,
|
|
173711
|
-
memoriesIncluded: memories.length,
|
|
173712
|
-
wmBudget,
|
|
173713
|
-
sessionCacheHits,
|
|
173714
|
-
tokensSavedBySessionCache
|
|
173715
|
-
});
|
|
173716
|
-
return {
|
|
173717
|
-
context: finalContext,
|
|
173718
|
-
sources: workingSet.map((r2) => r2.filePath || "unknown"),
|
|
173719
|
-
resultsCount: workingSet.length,
|
|
173720
|
-
memoriesCount: memories.length,
|
|
173721
|
-
tokensSaved: totalTokensSaved,
|
|
173722
|
-
compressionRatio,
|
|
173723
|
-
sessionCacheHits,
|
|
173724
|
-
tokensSavedBySessionCache
|
|
173725
|
-
};
|
|
173726
|
-
}
|
|
173727
|
-
async searchMemoriesSafe(query, opts) {
|
|
173728
|
-
try {
|
|
173729
|
-
const result = await this.memoryCtrl.search({
|
|
173730
|
-
query,
|
|
173731
|
-
projectId: opts.projectId,
|
|
173732
|
-
userId: opts.userId,
|
|
173733
|
-
sessionId: opts.sessionId,
|
|
173734
|
-
includePersistent: true,
|
|
173735
|
-
minImportance: 0.3,
|
|
173736
|
-
limit: opts.limit
|
|
173737
|
-
});
|
|
173738
|
-
return result.memories;
|
|
173739
|
-
} catch (error51) {
|
|
173740
|
-
logger.warn("Memory search failed, continuing without memories", {
|
|
173741
|
-
error: error51.message,
|
|
173742
|
-
query: query.slice(0, 30)
|
|
173743
|
-
});
|
|
173744
|
-
return [];
|
|
173745
|
-
}
|
|
173746
|
-
}
|
|
173747
|
-
formatMemorySection(memories, tokenBudget) {
|
|
173748
|
-
if (memories.length === 0 || tokenBudget <= 0)
|
|
173749
|
-
return null;
|
|
173750
|
-
const parts = [
|
|
173751
|
-
`## Relevant Memories (from previous sessions)
|
|
173752
|
-
`
|
|
173753
|
-
];
|
|
173754
|
-
let usedTokens = estimateTokens(parts[0], "text");
|
|
173755
|
-
for (const memory of memories) {
|
|
173756
|
-
const typeLabel = (memory.type || "unknown").toUpperCase();
|
|
173757
|
-
const score = memory.score ? ` (relevance: ${(memory.score * 100).toFixed(0)}%)` : "";
|
|
173758
|
-
const importance = memory.importance ? ` [importance: ${(memory.importance * 100).toFixed(0)}%]` : "";
|
|
173759
|
-
const agent = memory.agentId ? ` (by: ${memory.agentId})` : "";
|
|
173760
|
-
const entry2 = `- **[${typeLabel}]**${score}${importance}${agent}: ${memory.content}`;
|
|
173761
|
-
const entryTokens = estimateTokens(entry2, "text");
|
|
173762
|
-
if (usedTokens + entryTokens > tokenBudget)
|
|
173763
|
-
break;
|
|
173764
|
-
parts.push(entry2);
|
|
173765
|
-
usedTokens += entryTokens;
|
|
173766
|
-
}
|
|
173767
|
-
return parts.length <= 1 ? null : parts.join(`
|
|
173768
|
-
`);
|
|
173769
|
-
}
|
|
173770
|
-
selectWorkingSet(results, tokenBudget) {
|
|
173771
|
-
if (!results.length || tokenBudget <= 0)
|
|
173772
|
-
return [];
|
|
173773
|
-
const selected = [];
|
|
173774
|
-
const selectedFiles = new Set;
|
|
173775
|
-
let usedTokens = 0;
|
|
173776
|
-
const sorted = [...results].sort((a12, b) => (b.score || 0) - (a12.score || 0));
|
|
173777
|
-
for (const result of sorted) {
|
|
173778
|
-
const filePath = result.filePath || "unknown";
|
|
173779
|
-
if (selectedFiles.has(filePath))
|
|
173780
|
-
continue;
|
|
173781
|
-
const content = result.content || result.preview || "";
|
|
173782
|
-
const tokens = estimateTokens(content, "code");
|
|
173783
|
-
if (usedTokens + tokens > tokenBudget)
|
|
173784
|
-
continue;
|
|
173785
|
-
selected.push(result);
|
|
173786
|
-
selectedFiles.add(filePath);
|
|
173787
|
-
usedTokens += tokens;
|
|
173788
|
-
}
|
|
173789
|
-
for (const result of sorted) {
|
|
173790
|
-
if (selected.includes(result))
|
|
173791
|
-
continue;
|
|
173792
|
-
const content = result.content || result.preview || "";
|
|
173793
|
-
const tokens = estimateTokens(content, "code");
|
|
173794
|
-
if (usedTokens + tokens > tokenBudget)
|
|
173795
|
-
continue;
|
|
173796
|
-
selected.push(result);
|
|
173797
|
-
usedTokens += tokens;
|
|
173798
|
-
}
|
|
173799
|
-
return selected;
|
|
173800
|
-
}
|
|
173801
|
-
}
|
|
173802
|
-
function looksLikeSymbol(query) {
|
|
173803
|
-
if (query.length > 80)
|
|
173804
|
-
return false;
|
|
173805
|
-
const words = query.trim().split(/\s+/);
|
|
173806
|
-
if (words.length > 3)
|
|
173807
|
-
return false;
|
|
173808
|
-
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(words[0]);
|
|
173809
|
-
}
|
|
173810
|
-
function formatGraphContext(defs, refs, tokenBudget) {
|
|
173811
|
-
const parts = [`## Symbol Graph
|
|
173812
|
-
`];
|
|
173813
|
-
if (defs.length > 0) {
|
|
173814
|
-
parts.push(`### Definition(s)
|
|
173815
|
-
`);
|
|
173816
|
-
for (const def of defs.slice(0, 3)) {
|
|
173817
|
-
parts.push(`- **${def.kind}** \`${def.name}\` \u2192 \`${def.file}\` L${def.lineStart}\u2013${def.lineEnd}`);
|
|
173818
|
-
if (def.docComment)
|
|
173819
|
-
parts.push(` > ${def.docComment.slice(0, 120)}`);
|
|
173820
|
-
if (def.snippet) {
|
|
173821
|
-
parts.push(" ```");
|
|
173822
|
-
parts.push(def.snippet.split(`
|
|
173823
|
-
`).slice(0, 8).join(`
|
|
173824
|
-
`));
|
|
173825
|
-
parts.push(" ```");
|
|
173826
|
-
}
|
|
173827
|
-
}
|
|
173828
|
-
parts.push("");
|
|
173829
|
-
}
|
|
173830
|
-
if (refs.length > 0) {
|
|
173831
|
-
parts.push(`### References (${refs.length} total)
|
|
173832
|
-
`);
|
|
173833
|
-
const byFile = new Map;
|
|
173834
|
-
for (const r2 of refs.slice(0, 30)) {
|
|
173835
|
-
const arr = byFile.get(r2.fromFile) ?? [];
|
|
173836
|
-
arr.push(r2.fromLine);
|
|
173837
|
-
byFile.set(r2.fromFile, arr);
|
|
173838
|
-
}
|
|
173839
|
-
for (const [file3, lines] of byFile) {
|
|
173840
|
-
parts.push(`- \`${file3}\` L${lines.join(", ")}`);
|
|
173841
|
-
}
|
|
173842
|
-
parts.push("");
|
|
173843
|
-
}
|
|
173844
|
-
const section = parts.join(`
|
|
173845
|
-
`);
|
|
173846
|
-
const charBudget = tokenBudget * 4;
|
|
173847
|
-
return section.length > charBudget ? section.slice(0, charBudget) + `
|
|
173848
|
-
...
|
|
173849
|
-
` : section;
|
|
173850
|
-
}
|
|
173851
|
-
|
|
173852
|
-
// ../../packages/core/dist/tools/get_optimized_context.js
|
|
174127
|
+
init_context_controller();
|
|
173853
174128
|
class GetOptimizedContextTool {
|
|
173854
174129
|
name = "get_optimized_context";
|
|
173855
174130
|
description = "Retrieve code context + persistent memories with maximum token efficiency (search + memories + compress)";
|
|
@@ -173949,6 +174224,86 @@ class GetOptimizedContextTool {
|
|
|
173949
174224
|
}
|
|
173950
174225
|
}
|
|
173951
174226
|
}
|
|
174227
|
+
// ../../packages/core/dist/tools/compress_context.js
|
|
174228
|
+
init_code_compressor();
|
|
174229
|
+
init_compress_with_metrics();
|
|
174230
|
+
init_dist();
|
|
174231
|
+
init_enum_validation();
|
|
174232
|
+
|
|
174233
|
+
class CompressContextTool {
|
|
174234
|
+
name = "compress_context";
|
|
174235
|
+
description = "Compress context using semantic compression (keeps structure, removes details)";
|
|
174236
|
+
inputSchema = {
|
|
174237
|
+
type: "object",
|
|
174238
|
+
properties: {
|
|
174239
|
+
content: {
|
|
174240
|
+
type: "string",
|
|
174241
|
+
description: "Content to compress"
|
|
174242
|
+
},
|
|
174243
|
+
strategy: {
|
|
174244
|
+
type: "string",
|
|
174245
|
+
enum: [
|
|
174246
|
+
"code_structure",
|
|
174247
|
+
"conversation_summary",
|
|
174248
|
+
"semantic_dedup",
|
|
174249
|
+
"hierarchical"
|
|
174250
|
+
],
|
|
174251
|
+
description: "Compression strategy",
|
|
174252
|
+
default: "code_structure"
|
|
174253
|
+
},
|
|
174254
|
+
language: {
|
|
174255
|
+
type: "string",
|
|
174256
|
+
description: "Programming language (for code compression)"
|
|
174257
|
+
},
|
|
174258
|
+
targetRatio: {
|
|
174259
|
+
type: "number",
|
|
174260
|
+
description: "Target compression ratio (0-1, e.g., 0.7 = 70% reduction)",
|
|
174261
|
+
default: 0.7
|
|
174262
|
+
}
|
|
174263
|
+
},
|
|
174264
|
+
required: ["content"]
|
|
174265
|
+
};
|
|
174266
|
+
compressor;
|
|
174267
|
+
constructor() {
|
|
174268
|
+
this.compressor = new CodeCompressor;
|
|
174269
|
+
}
|
|
174270
|
+
async handle(params) {
|
|
174271
|
+
const { content, language, targetRatio = 0.7 } = params;
|
|
174272
|
+
const strategy = validateEnum("strategy", params.strategy ?? "code_structure", [
|
|
174273
|
+
"code_structure",
|
|
174274
|
+
"conversation_summary",
|
|
174275
|
+
"semantic_dedup",
|
|
174276
|
+
"hierarchical"
|
|
174277
|
+
]);
|
|
174278
|
+
try {
|
|
174279
|
+
const metrics2 = await compressWithMetrics(this.compressor, content, strategy, { language, targetRatio });
|
|
174280
|
+
return {
|
|
174281
|
+
success: true,
|
|
174282
|
+
data: {
|
|
174283
|
+
compressed: metrics2.compressed,
|
|
174284
|
+
originalLength: content.length,
|
|
174285
|
+
compressedLength: metrics2.compressed.length,
|
|
174286
|
+
originalTokens: metrics2.originalTokens,
|
|
174287
|
+
compressedTokens: metrics2.compressedTokens,
|
|
174288
|
+
strategy
|
|
174289
|
+
},
|
|
174290
|
+
metadata: {
|
|
174291
|
+
tokensSaved: metrics2.tokensSaved,
|
|
174292
|
+
compressionRatio: metrics2.compressionRatio
|
|
174293
|
+
}
|
|
174294
|
+
};
|
|
174295
|
+
} catch (error51) {
|
|
174296
|
+
logger.error("Failed to compress context", error51, {
|
|
174297
|
+
strategy,
|
|
174298
|
+
contentLength: typeof content === "string" ? content.length : 0
|
|
174299
|
+
});
|
|
174300
|
+
return {
|
|
174301
|
+
success: false,
|
|
174302
|
+
error: `Failed to compress context: ${error51.message}`
|
|
174303
|
+
};
|
|
174304
|
+
}
|
|
174305
|
+
}
|
|
174306
|
+
}
|
|
173952
174307
|
// ../../packages/core/dist/tools/store_memory.js
|
|
173953
174308
|
init_dist();
|
|
173954
174309
|
init_memory_controller();
|
|
@@ -175963,331 +176318,12 @@ class FetchAndIndexTool {
|
|
|
175963
176318
|
return this.run(params);
|
|
175964
176319
|
}
|
|
175965
176320
|
}
|
|
175966
|
-
// ../../packages/core/dist/controllers/index.js
|
|
175967
|
-
init_memory_controller();
|
|
175968
|
-
init_search_controller();
|
|
175969
|
-
|
|
175970
|
-
// ../../packages/core/dist/controllers/executor-controller.js
|
|
175971
|
-
init_dist();
|
|
175972
|
-
init_executor2();
|
|
175973
|
-
init_enum_validation();
|
|
175974
|
-
import { cpus as cpus2 } from "os";
|
|
175975
|
-
var EXECUTOR_LANGUAGES = [
|
|
175976
|
-
"javascript",
|
|
175977
|
-
"typescript",
|
|
175978
|
-
"python",
|
|
175979
|
-
"shell",
|
|
175980
|
-
"ruby",
|
|
175981
|
-
"go",
|
|
175982
|
-
"rust",
|
|
175983
|
-
"php",
|
|
175984
|
-
"perl",
|
|
175985
|
-
"r"
|
|
175986
|
-
];
|
|
175987
|
-
var MAX_BATCH_COMMANDS = 256;
|
|
175988
|
-
function applyIntent(result, intent) {
|
|
175989
|
-
if (!intent || !result.stdout)
|
|
175990
|
-
return result;
|
|
175991
|
-
const ir = intentSearch(result.stdout, intent);
|
|
175992
|
-
if (!ir.searched)
|
|
175993
|
-
return result;
|
|
175994
|
-
const rendered = renderIntentResult(ir, intent);
|
|
175995
|
-
return {
|
|
175996
|
-
...result,
|
|
175997
|
-
stdout: `${rendered}
|
|
175998
|
-
|
|
175999
|
-
--- tail (last 512 chars) ---
|
|
176000
|
-
${result.stdout.slice(-512)}`
|
|
176001
|
-
};
|
|
176002
|
-
}
|
|
176003
|
-
|
|
176004
|
-
class ExecutorController {
|
|
176005
|
-
static instance = null;
|
|
176006
|
-
executor;
|
|
176007
|
-
constructor(executor) {
|
|
176008
|
-
this.executor = executor ?? new PolyglotExecutor;
|
|
176009
|
-
}
|
|
176010
|
-
static getInstance() {
|
|
176011
|
-
if (!ExecutorController.instance) {
|
|
176012
|
-
ExecutorController.instance = new ExecutorController;
|
|
176013
|
-
}
|
|
176014
|
-
return ExecutorController.instance;
|
|
176015
|
-
}
|
|
176016
|
-
static resetInstance() {
|
|
176017
|
-
ExecutorController.instance?.executor.cleanupBackgrounded();
|
|
176018
|
-
ExecutorController.instance = null;
|
|
176019
|
-
}
|
|
176020
|
-
get runtimes() {
|
|
176021
|
-
return this.executor.runtimes;
|
|
176022
|
-
}
|
|
176023
|
-
async execute(params) {
|
|
176024
|
-
try {
|
|
176025
|
-
const language = validateEnum("language", params.language, EXECUTOR_LANGUAGES);
|
|
176026
|
-
const result = await this.executor.execute({
|
|
176027
|
-
language,
|
|
176028
|
-
code: params.code,
|
|
176029
|
-
timeout: params.timeout,
|
|
176030
|
-
background: params.background,
|
|
176031
|
-
cwd: params.cwd
|
|
176032
|
-
});
|
|
176033
|
-
const finalResult = applyIntent(result, params.intent);
|
|
176034
|
-
const ok = !finalResult.timedOut && finalResult.exitCode === 0;
|
|
176035
|
-
return {
|
|
176036
|
-
success: ok,
|
|
176037
|
-
data: {
|
|
176038
|
-
stdout: finalResult.stdout,
|
|
176039
|
-
stderr: finalResult.stderr,
|
|
176040
|
-
exitCode: finalResult.exitCode,
|
|
176041
|
-
timedOut: finalResult.timedOut,
|
|
176042
|
-
backgrounded: finalResult.backgrounded ?? false,
|
|
176043
|
-
command: finalResult.command,
|
|
176044
|
-
cwd: finalResult.cwd,
|
|
176045
|
-
sandboxMode: finalResult.sandboxMode
|
|
176046
|
-
}
|
|
176047
|
-
};
|
|
176048
|
-
} catch (error51) {
|
|
176049
|
-
logger.error("execute failed", error51, {
|
|
176050
|
-
language: params.language
|
|
176051
|
-
});
|
|
176052
|
-
return {
|
|
176053
|
-
success: false,
|
|
176054
|
-
error: `execute failed: ${error51.message}`
|
|
176055
|
-
};
|
|
176056
|
-
}
|
|
176057
|
-
}
|
|
176058
|
-
async executeFile(params) {
|
|
176059
|
-
try {
|
|
176060
|
-
const language = validateEnum("language", params.language, EXECUTOR_LANGUAGES);
|
|
176061
|
-
const result = await this.executor.executeFile({
|
|
176062
|
-
path: params.path,
|
|
176063
|
-
language,
|
|
176064
|
-
code: params.code,
|
|
176065
|
-
timeout: params.timeout
|
|
176066
|
-
});
|
|
176067
|
-
const blocked = result.stderr?.startsWith("Blocked:");
|
|
176068
|
-
if (blocked) {
|
|
176069
|
-
return { success: false, error: result.stderr };
|
|
176070
|
-
}
|
|
176071
|
-
const finalResult = applyIntent(result, params.intent);
|
|
176072
|
-
const ok = !finalResult.timedOut && finalResult.exitCode === 0;
|
|
176073
|
-
return {
|
|
176074
|
-
success: ok,
|
|
176075
|
-
data: {
|
|
176076
|
-
stdout: finalResult.stdout,
|
|
176077
|
-
stderr: finalResult.stderr,
|
|
176078
|
-
exitCode: finalResult.exitCode,
|
|
176079
|
-
timedOut: finalResult.timedOut,
|
|
176080
|
-
command: finalResult.command,
|
|
176081
|
-
cwd: finalResult.cwd,
|
|
176082
|
-
sandboxMode: finalResult.sandboxMode
|
|
176083
|
-
}
|
|
176084
|
-
};
|
|
176085
|
-
} catch (error51) {
|
|
176086
|
-
logger.error("execute_file failed", error51, {
|
|
176087
|
-
path: params.path,
|
|
176088
|
-
language: params.language
|
|
176089
|
-
});
|
|
176090
|
-
return {
|
|
176091
|
-
success: false,
|
|
176092
|
-
error: `execute_file failed: ${error51.message}`
|
|
176093
|
-
};
|
|
176094
|
-
}
|
|
176095
|
-
}
|
|
176096
|
-
async batchExecute(params) {
|
|
176097
|
-
const { commands, concurrency, cwd, timeout } = params;
|
|
176098
|
-
if (!Array.isArray(commands) || commands.length === 0) {
|
|
176099
|
-
return { success: false, error: "commands must be a non-empty array." };
|
|
176100
|
-
}
|
|
176101
|
-
if (commands.length > MAX_BATCH_COMMANDS) {
|
|
176102
|
-
return {
|
|
176103
|
-
success: false,
|
|
176104
|
-
error: `batch_execute accepts at most ${MAX_BATCH_COMMANDS} commands; received ${commands.length}. Split the batch or reduce the payload.`
|
|
176105
|
-
};
|
|
176106
|
-
}
|
|
176107
|
-
const effectiveConcurrency = concurrency && concurrency > 0 ? concurrency : Math.max(1, cpus2().length);
|
|
176108
|
-
const perTimeout = timeout ?? DEFAULT_TIMEOUT_MS2;
|
|
176109
|
-
try {
|
|
176110
|
-
const poolResult = await runPool(commands.map((cmd) => ({
|
|
176111
|
-
run: () => this.executor.execute({
|
|
176112
|
-
language: "shell",
|
|
176113
|
-
code: cmd,
|
|
176114
|
-
timeout: perTimeout,
|
|
176115
|
-
cwd
|
|
176116
|
-
})
|
|
176117
|
-
})), { concurrency: effectiveConcurrency });
|
|
176118
|
-
const results = poolResult.settled.map((s, i) => {
|
|
176119
|
-
if (s.status === "fulfilled") {
|
|
176120
|
-
const r2 = s.value;
|
|
176121
|
-
return {
|
|
176122
|
-
command: commands[i],
|
|
176123
|
-
stdout: r2.stdout,
|
|
176124
|
-
stderr: r2.stderr,
|
|
176125
|
-
exitCode: r2.exitCode,
|
|
176126
|
-
timedOut: r2.timedOut,
|
|
176127
|
-
sandboxMode: r2.sandboxMode
|
|
176128
|
-
};
|
|
176129
|
-
}
|
|
176130
|
-
return {
|
|
176131
|
-
command: commands[i],
|
|
176132
|
-
stdout: "",
|
|
176133
|
-
stderr: String(s.reason ?? "unknown error"),
|
|
176134
|
-
exitCode: null,
|
|
176135
|
-
timedOut: false,
|
|
176136
|
-
sandboxMode: getSandboxMode()
|
|
176137
|
-
};
|
|
176138
|
-
});
|
|
176139
|
-
const anyFailed = results.some((r2) => r2.exitCode !== 0 || r2.timedOut);
|
|
176140
|
-
return {
|
|
176141
|
-
success: !anyFailed,
|
|
176142
|
-
data: {
|
|
176143
|
-
results,
|
|
176144
|
-
concurrency: poolResult.effectiveConcurrency,
|
|
176145
|
-
capped: poolResult.capped
|
|
176146
|
-
}
|
|
176147
|
-
};
|
|
176148
|
-
} catch (error51) {
|
|
176149
|
-
logger.error("batch_execute failed", error51);
|
|
176150
|
-
return {
|
|
176151
|
-
success: false,
|
|
176152
|
-
error: `batch_execute failed: ${error51.message}`
|
|
176153
|
-
};
|
|
176154
|
-
}
|
|
176155
|
-
}
|
|
176156
|
-
static get MAX_TIMEOUT_MS() {
|
|
176157
|
-
return MAX_TIMEOUT_MS;
|
|
176158
|
-
}
|
|
176159
|
-
}
|
|
176160
|
-
// ../../packages/core/dist/controllers/graph-controller.js
|
|
176161
|
-
init_dist();
|
|
176162
|
-
init_trace_path();
|
|
176163
|
-
init_impact_analysis();
|
|
176164
|
-
init_definition_lookup();
|
|
176165
|
-
|
|
176166
|
-
class GraphController {
|
|
176167
|
-
static instance = null;
|
|
176168
|
-
constructor() {}
|
|
176169
|
-
static getInstance() {
|
|
176170
|
-
if (!GraphController.instance) {
|
|
176171
|
-
GraphController.instance = new GraphController;
|
|
176172
|
-
}
|
|
176173
|
-
return GraphController.instance;
|
|
176174
|
-
}
|
|
176175
|
-
async tracePath(input) {
|
|
176176
|
-
const projectId = input.projectId;
|
|
176177
|
-
const seed = input.function_name ?? input.symbol ?? input.qualifiedName;
|
|
176178
|
-
if (!projectId)
|
|
176179
|
-
throw new Error("projectId is required");
|
|
176180
|
-
if (!seed)
|
|
176181
|
-
throw new Error("function_name (or symbol/qualifiedName) is required");
|
|
176182
|
-
const t0 = performance.now();
|
|
176183
|
-
const result = await tracePathService.tracePath({
|
|
176184
|
-
symbol: input.function_name ?? input.symbol ?? "",
|
|
176185
|
-
function_name: input.function_name,
|
|
176186
|
-
qualifiedName: input.qualifiedName,
|
|
176187
|
-
projectId,
|
|
176188
|
-
direction: input.direction,
|
|
176189
|
-
mode: input.mode,
|
|
176190
|
-
depth: input.depth,
|
|
176191
|
-
include_tests: input.include_tests,
|
|
176192
|
-
edge_types: input.edge_types
|
|
176193
|
-
});
|
|
176194
|
-
logger.info("GraphController: trace_path", {
|
|
176195
|
-
projectId,
|
|
176196
|
-
symbol: seed,
|
|
176197
|
-
mode: result.mode,
|
|
176198
|
-
direction: result.direction,
|
|
176199
|
-
seeds: result.seeds.length,
|
|
176200
|
-
nodes: result.nodes.length,
|
|
176201
|
-
edges: result.edges.length,
|
|
176202
|
-
durationMs: Math.round(performance.now() - t0)
|
|
176203
|
-
});
|
|
176204
|
-
if (result.seeds.length === 0) {
|
|
176205
|
-
return {
|
|
176206
|
-
found: false,
|
|
176207
|
-
symbol: seed,
|
|
176208
|
-
projectId,
|
|
176209
|
-
...result.identityResolution ? { identityResolution: result.identityResolution } : {},
|
|
176210
|
-
hint: "Use search_definitions(search=...) to find the exact name, or pass a fully-qualified name (qualifiedName='rel/path.ts#Name')."
|
|
176211
|
-
};
|
|
176212
|
-
}
|
|
176213
|
-
return {
|
|
176214
|
-
found: true,
|
|
176215
|
-
result: {
|
|
176216
|
-
projectId: result.projectId,
|
|
176217
|
-
symbol: result.symbol,
|
|
176218
|
-
mode: result.mode,
|
|
176219
|
-
direction: result.direction,
|
|
176220
|
-
edgeTypes: result.edgeTypes,
|
|
176221
|
-
seeds: result.seeds,
|
|
176222
|
-
truncated: result.truncated,
|
|
176223
|
-
nodes_total: result.nodes_total,
|
|
176224
|
-
nodes_shown: result.nodes_shown,
|
|
176225
|
-
nodes_omitted: result.nodes_omitted,
|
|
176226
|
-
nodeCount: result.nodes.length,
|
|
176227
|
-
edgeCount: result.edges.length,
|
|
176228
|
-
chains: result.chains,
|
|
176229
|
-
nodes: result.nodes,
|
|
176230
|
-
edges: result.edges,
|
|
176231
|
-
...result.identityResolution ? { identity: toSymbolIdentityResolution(result.identityResolution) } : {}
|
|
176232
|
-
}
|
|
176233
|
-
};
|
|
176234
|
-
}
|
|
176235
|
-
async analyzeImpact(input) {
|
|
176236
|
-
if (!input.projectId)
|
|
176237
|
-
throw new Error("projectId is required");
|
|
176238
|
-
if (!input.projectPath)
|
|
176239
|
-
throw new Error("projectPath is required");
|
|
176240
|
-
const t0 = performance.now();
|
|
176241
|
-
const result = await impactAnalysisService.analyze({
|
|
176242
|
-
projectId: input.projectId,
|
|
176243
|
-
projectPath: input.projectPath,
|
|
176244
|
-
scope: input.scope ?? "unstaged",
|
|
176245
|
-
baseBranch: input.base_branch,
|
|
176246
|
-
since: input.since,
|
|
176247
|
-
depth: input.depth,
|
|
176248
|
-
paths: input.paths,
|
|
176249
|
-
diffRunner: input.diffRunner
|
|
176250
|
-
});
|
|
176251
|
-
logger.info("GraphController: impact_analysis", {
|
|
176252
|
-
projectId: input.projectId,
|
|
176253
|
-
scope: result.scope,
|
|
176254
|
-
changedFiles: result.changedFiles.length,
|
|
176255
|
-
impacted: result.impacted.length,
|
|
176256
|
-
truncated: result.truncated,
|
|
176257
|
-
durationMs: Math.round(performance.now() - t0)
|
|
176258
|
-
});
|
|
176259
|
-
return {
|
|
176260
|
-
projectId: result.projectId,
|
|
176261
|
-
scope: result.scope,
|
|
176262
|
-
baseBranch: result.baseBranch,
|
|
176263
|
-
since: result.since,
|
|
176264
|
-
depth: result.depth,
|
|
176265
|
-
changedFileCount: result.changedFiles.length,
|
|
176266
|
-
changedFiles: result.changedFiles,
|
|
176267
|
-
impactedCount: result.impacted.length,
|
|
176268
|
-
truncated: result.truncated,
|
|
176269
|
-
impacted: result.impacted,
|
|
176270
|
-
untrackedFiltered: result.untrackedFiltered,
|
|
176271
|
-
impacted_total: result.impacted_total,
|
|
176272
|
-
impacted_shown: result.impacted_shown,
|
|
176273
|
-
impacted_omitted: result.impacted_omitted,
|
|
176274
|
-
note: result.note
|
|
176275
|
-
};
|
|
176276
|
-
}
|
|
176277
|
-
}
|
|
176278
176321
|
// ../../packages/core/dist/index.js
|
|
176279
176322
|
init_memory_repository_pg();
|
|
176280
176323
|
init_memory_repository_factory();
|
|
176281
|
-
init_services();
|
|
176282
|
-
|
|
176283
|
-
// ../../packages/core/dist/data/vector/hybrid-search.js
|
|
176284
176324
|
init_vector_store_factory();
|
|
176285
|
-
|
|
176286
|
-
init_dist();
|
|
176325
|
+
init_services();
|
|
176287
176326
|
|
|
176288
|
-
// ../../packages/core/dist/data/vector/index.js
|
|
176289
|
-
init_vector_store_factory();
|
|
176290
|
-
init_base_vector_store();
|
|
176291
176327
|
// ../../packages/core/dist/data/graph-generation/index.js
|
|
176292
176328
|
init_graph_generation_repository_pg();
|
|
176293
176329
|
init_graph_generation_repository_factory();
|