orion-super-agent-dev 0.1.32 → 0.1.34

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.
Binary file
Binary file
Binary file
Binary file
@@ -2792,6 +2792,8 @@ function normalizeEdge(edge) {
2792
2792
  var EMPTY_FILE_SET = /* @__PURE__ */ new Set();
2793
2793
  var GRAPH_EXPANSION_MAX_SEEDS = 5;
2794
2794
  var GRAPH_EXPANSION_PER_SEED = 8;
2795
+ var JUDGE_DEFINES_SHOWN = 6;
2796
+ var JUDGE_TESTS_SHOWN = 3;
2795
2797
  var GRAPH_DEPENDENT_VERB = {
2796
2798
  calls: "calls into",
2797
2799
  imports: "imports",
@@ -3391,7 +3393,11 @@ var WorkspaceIndexStore = class {
3391
3393
  const missRank = options.attention?.length ?? 0;
3392
3394
  return [...candidates].map((p) => [p, sets.filter((s) => s.has(p)).length]).sort((a, b) => b[1] - a[1] || (attentionRank.get(a[0]) ?? missRank) - (attentionRank.get(b[0]) ?? missRank) || a[0].localeCompare(b[0])).slice(0, options.topK ?? 30);
3393
3395
  }
3394
- async searchCodebase(input) {
3396
+ /** The ranked search before rendering. `pool` widens the fusion past `max_results`
3397
+ * (the judge's candidate list) — every channel then contributes up to the pool and
3398
+ * the fused order runs to it; the cards, and the related context behind them, stop
3399
+ * at `max_results` as they always did. A string is the not-ready answer, as-is. */
3400
+ async rankCodebase(input, pool = 0) {
3395
3401
  const query = String(input.query ?? "").trim();
3396
3402
  if (!query) throw new Error("`query` is required");
3397
3403
  const scope = String(input.scope ?? "").trim() || void 0;
@@ -3409,14 +3415,37 @@ var WorkspaceIndexStore = class {
3409
3415
  ].join("\n");
3410
3416
  }
3411
3417
  const attention = Array.isArray(input.attention) ? input.attention.filter((p) => typeof p === "string") : void 0;
3412
- const perSource = Math.max(maxResults, 12);
3418
+ const fusionSize = Math.max(maxResults, pool);
3419
+ const perSource = Math.max(fusionSize, 12);
3413
3420
  const termSets = await this.termFileSets(queryTerms(query));
3414
3421
  const symbols = this.symbolHitsForQuery(query, perSource, attention, scope);
3415
3422
  const files = this.fileHitsForQuery(query, perSource, attention, scope, termSets);
3416
3423
  const content = await this.contentHitsForQuery(query, perSource, attention, scope, termSets);
3417
3424
  const seeds = this.graphExpansionSeeds(symbols, files);
3418
3425
  const graph = seeds.length > 0 ? this.graphHitsForQuery(seeds, perSource, scope, queryTerms(query), termSets) : [];
3419
- const merged = fuseHits([symbols, files, content, graph], maxResults);
3426
+ const merged = fuseHits([symbols, files, content, graph], fusionSize);
3427
+ const topPaths = [];
3428
+ const seen = /* @__PURE__ */ new Set();
3429
+ for (const hit of merged) {
3430
+ const p = String(hit.path ?? "");
3431
+ if (!p || seen.has(p)) continue;
3432
+ seen.add(p);
3433
+ const reasons = Array.isArray(hit.result_types) ? [...hit.result_types.map(String)] : [String(hit.result_type ?? "match")];
3434
+ if (Array.isArray(hit.reasons)) reasons.push(...hit.reasons.map(String));
3435
+ topPaths.push([p, reasons]);
3436
+ }
3437
+ const testsLimit = detailLimit(detail, 3, 6, 12);
3438
+ const relatedLimit = Math.max(detailLimit(detail, 2, 4, 7), testsLimit);
3439
+ const relatedByPath = /* @__PURE__ */ new Map();
3440
+ for (const [p] of topPaths.slice(0, maxResults)) {
3441
+ relatedByPath.set(p, await this.relatedContextForPath(p, relatedLimit));
3442
+ }
3443
+ return { query, scope, detail, intent, maxResults, attention, symbols, content, topPaths, relatedByPath };
3444
+ }
3445
+ /** The normal level's result for the model, from a ranked search. */
3446
+ renderSearch(r) {
3447
+ const { query, scope, detail, intent, maxResults, symbols, content, relatedByPath } = r;
3448
+ const cardPaths = r.topPaths.slice(0, maxResults);
3420
3449
  const lines = [
3421
3450
  "Index Status",
3422
3451
  `- ${this.indexSummary()}`,
@@ -3430,31 +3459,16 @@ var WorkspaceIndexStore = class {
3430
3459
  "",
3431
3460
  "Top Files"
3432
3461
  ];
3433
- if (merged.length === 0) {
3462
+ if (cardPaths.length === 0) {
3434
3463
  lines.push("- no indexed matches");
3435
3464
  lines.push("");
3436
3465
  lines.push("Suggested Next Moves");
3437
3466
  lines.push("- use grep for exact strings or when the index has not learned this term");
3438
3467
  return lines.join("\n");
3439
3468
  }
3440
- const topPaths = [];
3441
- const seen = /* @__PURE__ */ new Set();
3442
- for (const hit of merged) {
3443
- const p = String(hit.path ?? "");
3444
- if (!p || seen.has(p)) continue;
3445
- seen.add(p);
3446
- const reasons = Array.isArray(hit.result_types) ? [...hit.result_types.map(String)] : [String(hit.result_type ?? "match")];
3447
- if (Array.isArray(hit.reasons)) reasons.push(...hit.reasons.map(String));
3448
- topPaths.push([p, reasons]);
3449
- }
3450
3469
  const testsLimit = detailLimit(detail, 3, 6, 12);
3451
- const relatedLimit = Math.max(detailLimit(detail, 2, 4, 7), testsLimit);
3452
- const relatedByPath = /* @__PURE__ */ new Map();
3453
- for (const [p] of topPaths) {
3454
- relatedByPath.set(p, await this.relatedContextForPath(p, relatedLimit));
3455
- }
3456
3470
  let cardRank = 0;
3457
- for (const [p, cardReasons] of topPaths.slice(0, maxResults)) {
3471
+ for (const [p, cardReasons] of cardPaths) {
3458
3472
  cardRank += 1;
3459
3473
  lines.push(...this.renderFileCard(p, cardRank, cardReasons, detail, relatedByPath.get(p)));
3460
3474
  }
@@ -3481,14 +3495,14 @@ var WorkspaceIndexStore = class {
3481
3495
  }
3482
3496
  }
3483
3497
  const relatedTestLists = [];
3484
- for (const [p] of topPaths) {
3498
+ for (const [p] of cardPaths) {
3485
3499
  relatedTestLists.push((relatedByPath.get(p)?.tests ?? []).slice(0, testsLimit));
3486
3500
  }
3487
3501
  const relatedTests = dedupe(relatedTestLists.flat(), (p) => p, testsLimit);
3488
3502
  if (relatedTests.length > 0) {
3489
3503
  lines.push("", "Likely Tests", ...relatedTests.map((p) => `- ${p}`));
3490
3504
  }
3491
- const hasGraphHits = topPaths.some(([, reasons]) => reasons.some((r) => r === "graph" || r.startsWith("graph:")));
3505
+ const hasGraphHits = cardPaths.some(([, reasons]) => reasons.some((r2) => r2 === "graph" || r2.startsWith("graph:")));
3492
3506
  lines.push(
3493
3507
  "",
3494
3508
  "Use This Result",
@@ -3509,6 +3523,51 @@ var WorkspaceIndexStore = class {
3509
3523
  );
3510
3524
  return lines.join("\n");
3511
3525
  }
3526
+ async searchCodebase(input) {
3527
+ const ranked = await this.rankCodebase(input);
3528
+ return typeof ranked === "string" ? ranked : this.renderSearch(ranked);
3529
+ }
3530
+ /** The judge's candidate list: the same search over the stamp's wider pool, its
3531
+ * fused order as metadata beside the ordinary output. Each candidate names its
3532
+ * best-matching lines (the ranker's top chunk for the file, else its first chunk)
3533
+ * as a RANGE — the executor reads the leading ones' text, since the store never
3534
+ * touches the disk. Null while the index is not ready (the caller runs the plain
3535
+ * search, whose not-ready answer says so). */
3536
+ async searchCodebaseJudged(input, stamp) {
3537
+ const ranked = await this.rankCodebase(input, Math.max(1, Math.floor(stamp.pool)));
3538
+ if (typeof ranked === "string") return null;
3539
+ const attention = new Set(ranked.attention ?? []);
3540
+ const topChunkByPath = /* @__PURE__ */ new Map();
3541
+ for (const hit of ranked.content) {
3542
+ if (hit.result_type !== "chunk") continue;
3543
+ const p = String(hit.path ?? "");
3544
+ if (!p || topChunkByPath.has(p)) continue;
3545
+ topChunkByPath.set(p, { start_line: Number(hit.line), end_line: Number(hit.end_line) });
3546
+ }
3547
+ const candidates = ranked.topPaths.map(([p, reasons], i2) => {
3548
+ const meta = this.fileMeta.get(p);
3549
+ const flags2 = [];
3550
+ if (meta?.is_test) flags2.push("test");
3551
+ if (meta?.is_generated) flags2.push("generated");
3552
+ if (attention.has(p)) flags2.push("open");
3553
+ const syms = this.listSymbols(p);
3554
+ const defines = syms.slice(0, JUDGE_DEFINES_SHOWN).map((s) => `${s.name}@${s.line}`);
3555
+ if (syms.length > JUDGE_DEFINES_SHOWN) defines.push(`(+${syms.length - JUDGE_DEFINES_SHOWN} more)`);
3556
+ const first = this.chunkIndex.bestChunksForPath(p, 1)[0];
3557
+ const range = topChunkByPath.get(p) ?? (first ? { start_line: first.startLine, end_line: first.endLine } : null);
3558
+ return {
3559
+ rank: i2 + 1,
3560
+ path: p,
3561
+ reasons: dedupe(reasons, (r) => r, 6),
3562
+ summary: this.fileSummaryFor(p),
3563
+ defines,
3564
+ flags: flags2,
3565
+ tests: (ranked.relatedByPath.get(p)?.tests ?? []).slice(0, JUDGE_TESTS_SHOWN),
3566
+ snippet: range && range.start_line > 0 ? { ...range, text: "" } : null
3567
+ };
3568
+ });
3569
+ return { output: this.renderSearch(ranked), index_summary: this.indexSummary(), candidates };
3570
+ }
3512
3571
  async traceCodebase(input) {
3513
3572
  const target = String(input.target ?? "").trim();
3514
3573
  if (!target) throw new Error("`target` is required");
@@ -8330,6 +8389,9 @@ var VectorStore = class {
8330
8389
  };
8331
8390
 
8332
8391
  // ../packages/orion-client-core/src/enhancedRetrieval.ts
8392
+ function vectorLayerModel(provider, model) {
8393
+ return provider ? `${provider}/${model}` : model;
8394
+ }
8333
8395
  var ENHANCED_TEST_DIRS = /* @__PURE__ */ new Set(["test", "tests", "testing"]);
8334
8396
  var ENHANCED_CHUNK_SOURCE_CHARS = 1e4;
8335
8397
  var ENHANCED_EMBED_BATCH_SIZE = 16;
@@ -8475,7 +8537,13 @@ async function runEnhancedRetrieve(request, deps) {
8475
8537
  files_truncated: 0,
8476
8538
  elapsed_ms: 0
8477
8539
  };
8478
- const store2 = new VectorStore({ root: deps.root, model, baseDir: deps.baseDir, fsOps: deps.fsOps, log });
8540
+ const store2 = new VectorStore({
8541
+ root: deps.root,
8542
+ model: vectorLayerModel(provider, model),
8543
+ baseDir: deps.baseDir,
8544
+ fsOps: deps.fsOps,
8545
+ log
8546
+ });
8479
8547
  await store2.load();
8480
8548
  try {
8481
8549
  const rowByHash = /* @__PURE__ */ new Map();
@@ -8863,6 +8931,7 @@ var READ_METHODS = /* @__PURE__ */ new Set([
8863
8931
  "readRangeSuggestions",
8864
8932
  "readContextHeader",
8865
8933
  "searchCodebase",
8934
+ "searchCodebaseJudged",
8866
8935
  "traceCodebase",
8867
8936
  "enhancedRetrieve",
8868
8937
  "dependencyAdvisory"
@@ -8943,6 +9012,11 @@ async function handle3(method, params) {
8943
9012
  );
8944
9013
  case "searchCodebase":
8945
9014
  return store.searchCodebase(params.input ?? {});
9015
+ case "searchCodebaseJudged":
9016
+ return store.searchCodebaseJudged(
9017
+ params.input ?? {},
9018
+ params.stamp
9019
+ );
8946
9020
  case "traceCodebase":
8947
9021
  return store.traceCodebase(params.input ?? {});
8948
9022
  case "enhancedRetrieve":