@cortexkit/aft-opencode 0.12.2 → 0.13.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iGAAiG;IACjG,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAiB;IAEzD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,iBAAiB,CAAoE;IAC7F,OAAO,CAAC,iBAAiB,CAA8C;gBAGrE,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;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AK;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAA8B;IACvD,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,iBAAiB,CAAoE;IAC7F,OAAO,CAAC,iBAAiB,CAA8C;gBAGrE,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAW3C,mEAAmE;IACnE,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,oDAAoD;IACpD,OAAO,IAAI,OAAO;IAIlB;;;OAGG;IACG,IAAI,CACR,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAwFnC,8DAA8D;IACxD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/B,gGAAgG;YAClF,YAAY;IAoB1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,YAAY;IAuFpB,OAAO,CAAC,YAAY;IA4BpB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,WAAW;IA8BnB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;CAM/B"}
@@ -9,6 +9,6 @@ export declare function selectOne(message: string, options: {
9
9
  export declare function text(message: string, options?: {
10
10
  placeholder?: string;
11
11
  defaultValue?: string;
12
- validate?: (value: string) => string | undefined;
12
+ validate?: (value: string) => string | Error | undefined;
13
13
  }): Promise<string>;
14
14
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,GAAG,EACH,IAAI,EACJ,KAAK,EAEL,OAAO,EACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAS5C,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlF;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GACjE,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7C,GACL,OAAO,CAAC,MAAM,CAAC,CASjB"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,GAAG,EACH,IAAI,EACJ,KAAK,EAEL,OAAO,EACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAS5C,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlF;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GACjE,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;CACrD,GACL,OAAO,CAAC,MAAM,CAAC,CAcjB"}
package/dist/cli.js CHANGED
@@ -9745,12 +9745,15 @@ async function confirm(message, defaultYes = true) {
9745
9745
  return result;
9746
9746
  }
9747
9747
  async function text(message, options = {}) {
9748
- const result = await Ot({
9748
+ const promptOptions = {
9749
9749
  message,
9750
9750
  ...options.placeholder ? { placeholder: options.placeholder } : {},
9751
9751
  ...options.defaultValue !== undefined ? { defaultValue: options.defaultValue } : {},
9752
- ...options.validate ? { validate: options.validate } : {}
9753
- });
9752
+ ...options.validate ? {
9753
+ validate: (value) => options.validate?.(value ?? "")
9754
+ } : {}
9755
+ };
9756
+ const result = await Ot(promptOptions);
9754
9757
  handleCancel(result);
9755
9758
  return result;
9756
9759
  }
@@ -10173,9 +10176,9 @@ if (command === "setup") {
10173
10176
  console.log(" doctor --issue Collect diagnostics and open a GitHub issue");
10174
10177
  console.log("");
10175
10178
  console.log(" Usage:");
10176
- console.log(" bunx @cortexkit/aft-opencode@latest setup");
10177
- console.log(" bunx @cortexkit/aft-opencode@latest doctor");
10178
- console.log(" bunx @cortexkit/aft-opencode@latest doctor --issue");
10179
+ console.log(" bunx --bun @cortexkit/aft-opencode@latest setup");
10180
+ console.log(" bunx --bun @cortexkit/aft-opencode@latest doctor");
10181
+ console.log(" bunx --bun @cortexkit/aft-opencode@latest doctor --issue");
10179
10182
  console.log("");
10180
10183
  process.exit(command ? 1 : 0);
10181
10184
  }
package/dist/config.d.ts CHANGED
@@ -36,6 +36,18 @@ export declare const AftConfigSchema: z.ZodObject<{
36
36
  restrict_to_project_root: z.ZodOptional<z.ZodBoolean>;
37
37
  experimental_search_index: z.ZodOptional<z.ZodBoolean>;
38
38
  experimental_semantic_search: z.ZodOptional<z.ZodBoolean>;
39
+ semantic: z.ZodOptional<z.ZodObject<{
40
+ backend: z.ZodOptional<z.ZodEnum<{
41
+ fastembed: "fastembed";
42
+ openai_compatible: "openai_compatible";
43
+ ollama: "ollama";
44
+ }>>;
45
+ model: z.ZodOptional<z.ZodString>;
46
+ base_url: z.ZodOptional<z.ZodString>;
47
+ api_key_env: z.ZodOptional<z.ZodString>;
48
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
49
+ max_batch_size: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strip>>;
39
51
  }, z.core.$strip>;
40
52
  export type AftConfig = z.infer<typeof AftConfigSchema>;
41
53
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwC1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAmIxD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAwBjE"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+CxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AA2KxD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAiCjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA6FlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,MAAM,EAAE,MAiVb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA6FlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,MAAM,EAAE,MA4Vb,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -21434,6 +21434,15 @@ var CheckerEnum = exports_external.enum([
21434
21434
  "staticcheck",
21435
21435
  "none"
21436
21436
  ]);
21437
+ var SemanticBackendEnum = exports_external.enum(["fastembed", "openai_compatible", "ollama"]);
21438
+ var SemanticConfigSchema = exports_external.object({
21439
+ backend: SemanticBackendEnum.optional(),
21440
+ model: exports_external.string().trim().min(1).optional(),
21441
+ base_url: exports_external.string().trim().min(1).optional(),
21442
+ api_key_env: exports_external.string().trim().min(1).optional(),
21443
+ timeout_ms: exports_external.number().int().positive().optional(),
21444
+ max_batch_size: exports_external.number().int().positive().optional()
21445
+ });
21437
21446
  var AftConfigSchema = exports_external.object({
21438
21447
  format_on_edit: exports_external.boolean().optional(),
21439
21448
  validate_on_edit: exports_external.enum(["syntax", "full"]).optional(),
@@ -21444,7 +21453,8 @@ var AftConfigSchema = exports_external.object({
21444
21453
  disabled_tools: exports_external.array(exports_external.string()).optional(),
21445
21454
  restrict_to_project_root: exports_external.boolean().optional(),
21446
21455
  experimental_search_index: exports_external.boolean().optional(),
21447
- experimental_semantic_search: exports_external.boolean().optional()
21456
+ experimental_semantic_search: exports_external.boolean().optional(),
21457
+ semantic: SemanticConfigSchema.optional()
21448
21458
  });
21449
21459
  function detectConfigFile(basePath) {
21450
21460
  const jsoncPath = `${basePath}.jsonc`;
@@ -21504,13 +21514,37 @@ function loadConfigFromPath(configPath) {
21504
21514
  return null;
21505
21515
  }
21506
21516
  }
21517
+ function mergeSemanticConfig(baseSemantic, overrideSemantic) {
21518
+ const projectSemantic = {};
21519
+ if (overrideSemantic) {
21520
+ if (overrideSemantic.model !== undefined)
21521
+ projectSemantic.model = overrideSemantic.model;
21522
+ if (overrideSemantic.timeout_ms !== undefined)
21523
+ projectSemantic.timeout_ms = overrideSemantic.timeout_ms;
21524
+ if (overrideSemantic.max_batch_size !== undefined)
21525
+ projectSemantic.max_batch_size = overrideSemantic.max_batch_size;
21526
+ }
21527
+ const semantic = {
21528
+ ...baseSemantic,
21529
+ ...projectSemantic
21530
+ };
21531
+ if (Object.values(semantic).every((value) => value === undefined)) {
21532
+ return;
21533
+ }
21534
+ return Object.fromEntries(Object.entries(semantic).filter(([, value]) => value !== undefined));
21535
+ }
21507
21536
  function mergeConfigs(base, override) {
21508
21537
  const disabledTools = [...base.disabled_tools ?? [], ...override.disabled_tools ?? []];
21538
+ const formatter = { ...base.formatter, ...override.formatter };
21539
+ const checker = { ...base.checker, ...override.checker };
21540
+ const semantic = mergeSemanticConfig(base.semantic, override.semantic);
21541
+ const { semantic: _stripSemantic, ...safeOverride } = override;
21509
21542
  return {
21510
21543
  ...base,
21511
- ...override,
21512
- formatter: { ...base.formatter, ...override.formatter },
21513
- checker: { ...base.checker, ...override.checker },
21544
+ ...safeOverride,
21545
+ ...Object.keys(formatter).length > 0 ? { formatter } : {},
21546
+ ...Object.keys(checker).length > 0 ? { checker } : {},
21547
+ semantic,
21514
21548
  ...disabledTools.length > 0 ? { disabled_tools: [...new Set(disabledTools)] } : {}
21515
21549
  };
21516
21550
  }
@@ -21533,6 +21567,9 @@ function loadAftConfig(projectDirectory) {
21533
21567
  let config2 = loadConfigFromPath(userConfigPath) ?? {};
21534
21568
  const projectConfig = loadConfigFromPath(projectConfigPath);
21535
21569
  if (projectConfig) {
21570
+ if (projectConfig.semantic?.backend !== undefined || projectConfig.semantic?.base_url !== undefined || projectConfig.semantic?.api_key_env !== undefined) {
21571
+ warn("Ignoring semantic.backend/base_url/api_key_env from project config (security: use user config for external backends)");
21572
+ }
21536
21573
  config2 = mergeConfigs(config2, projectConfig);
21537
21574
  }
21538
21575
  return config2;
@@ -22159,6 +22196,8 @@ async function extractZipArchive(archivePath, destinationDir) {
22159
22196
  import { spawn } from "child_process";
22160
22197
  import { homedir as homedir4 } from "os";
22161
22198
  import { join as join6 } from "path";
22199
+ var DEFAULT_BRIDGE_TIMEOUT_MS = 30000;
22200
+ var SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS = 5000;
22162
22201
  function compareSemver(a, b) {
22163
22202
  const pa = a.split(".").map(Number);
22164
22203
  const pb = b.split(".").map(Number);
@@ -22169,6 +22208,28 @@ function compareSemver(a, b) {
22169
22208
  }
22170
22209
  return 0;
22171
22210
  }
22211
+ function clampSemanticTimeout(configOverrides, bridgeTimeoutMs) {
22212
+ const semantic = configOverrides.semantic;
22213
+ if (!semantic || typeof semantic !== "object" || Array.isArray(semantic)) {
22214
+ return configOverrides;
22215
+ }
22216
+ const timeoutMs = semantic.timeout_ms;
22217
+ if (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs)) {
22218
+ return configOverrides;
22219
+ }
22220
+ const maxSemanticTimeoutMs = bridgeTimeoutMs > SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS ? bridgeTimeoutMs - SEMANTIC_TIMEOUT_SAFETY_MARGIN_MS : Math.max(1, bridgeTimeoutMs - 1);
22221
+ if (timeoutMs <= maxSemanticTimeoutMs) {
22222
+ return configOverrides;
22223
+ }
22224
+ warn(`semantic.timeout_ms=${timeoutMs} exceeds bridge timeout budget; clamping to ${maxSemanticTimeoutMs}ms (bridge timeout: ${bridgeTimeoutMs}ms)`);
22225
+ return {
22226
+ ...configOverrides,
22227
+ semantic: {
22228
+ ...semantic,
22229
+ timeout_ms: maxSemanticTimeoutMs
22230
+ }
22231
+ };
22232
+ }
22172
22233
 
22173
22234
  class BinaryBridge {
22174
22235
  static RESTART_RESET_MS = 5 * 60 * 1000;
@@ -22191,9 +22252,9 @@ class BinaryBridge {
22191
22252
  constructor(binaryPath, cwd, options, configOverrides) {
22192
22253
  this.binaryPath = binaryPath;
22193
22254
  this.cwd = cwd;
22194
- this.timeoutMs = options?.timeoutMs ?? 30000;
22255
+ this.timeoutMs = options?.timeoutMs ?? DEFAULT_BRIDGE_TIMEOUT_MS;
22195
22256
  this.maxRestarts = options?.maxRestarts ?? 3;
22196
- this.configOverrides = configOverrides ?? {};
22257
+ this.configOverrides = clampSemanticTimeout(configOverrides ?? {}, this.timeoutMs);
22197
22258
  this.minVersion = options?.minVersion;
22198
22259
  this.onVersionMismatch = options?.onVersionMismatch;
22199
22260
  }
@@ -22310,16 +22371,32 @@ class BinaryBridge {
22310
22371
  }
22311
22372
  spawnProcess() {
22312
22373
  log(`Spawning binary: ${this.binaryPath} (cwd: ${this.cwd})`);
22374
+ const semantic = this.configOverrides.semantic;
22375
+ const semanticBackend = (() => {
22376
+ if (semantic && typeof semantic === "object" && !Array.isArray(semantic)) {
22377
+ const candidate = semantic.backend;
22378
+ return typeof candidate === "string" ? candidate : undefined;
22379
+ }
22380
+ return;
22381
+ })();
22382
+ const useFastembedBackend = semanticBackend === undefined || semanticBackend === "fastembed" || semanticBackend === "";
22383
+ const ortDir = typeof this.configOverrides._ort_dylib_dir === "string" && useFastembedBackend ? this.configOverrides._ort_dylib_dir : null;
22384
+ const ortLibraryPath = ortDir == null ? null : join6(ortDir, process.platform === "win32" ? "onnxruntime.dll" : process.platform === "darwin" ? "libonnxruntime.dylib" : "libonnxruntime.so");
22385
+ const envPath = process.platform === "win32" && ortDir ? `${ortDir};${process.env.PATH ?? ""}` : process.env.PATH;
22386
+ const env = {
22387
+ ...process.env,
22388
+ ...envPath ? { PATH: envPath } : {}
22389
+ };
22390
+ if (useFastembedBackend) {
22391
+ env.FASTEMBED_CACHE_DIR = process.env.FASTEMBED_CACHE_DIR || (typeof this.configOverrides.storage_dir === "string" ? join6(this.configOverrides.storage_dir, "semantic", "models") : join6(homedir4() || "", ".cache", "fastembed"));
22392
+ if (ortLibraryPath) {
22393
+ env.ORT_DYLIB_PATH = ortLibraryPath;
22394
+ }
22395
+ }
22313
22396
  const child = spawn(this.binaryPath, [], {
22314
22397
  cwd: this.cwd,
22315
22398
  stdio: ["pipe", "pipe", "pipe"],
22316
- env: {
22317
- ...process.env,
22318
- FASTEMBED_CACHE_DIR: process.env.FASTEMBED_CACHE_DIR || (typeof this.configOverrides.storage_dir === "string" ? join6(this.configOverrides.storage_dir, "semantic", "models") : join6(homedir4() || "", ".cache", "fastembed")),
22319
- ...typeof this.configOverrides._ort_dylib_dir === "string" && {
22320
- ORT_DYLIB_PATH: join6(this.configOverrides._ort_dylib_dir, process.platform === "win32" ? "onnxruntime.dll" : process.platform === "darwin" ? "libonnxruntime.dylib" : "libonnxruntime.so")
22321
- }
22322
- }
22399
+ env
22323
22400
  });
22324
22401
  child.stdout?.on("data", (chunk) => {
22325
22402
  this.onStdoutData(chunk.toString("utf-8"));
@@ -22819,6 +22896,10 @@ function coerceAftStatus(response) {
22819
22896
  const features = asRecord(response.features);
22820
22897
  const searchIndex = asRecord(response.search_index);
22821
22898
  const semanticIndex = asRecord(response.semantic_index);
22899
+ const semanticConfig = {
22900
+ ...asRecord(response.semantic),
22901
+ ...asRecord(response.semantic_config)
22902
+ };
22822
22903
  const disk = asRecord(response.disk);
22823
22904
  const symbolCache = asRecord(response.symbol_cache);
22824
22905
  return {
@@ -22838,8 +22919,15 @@ function coerceAftStatus(response) {
22838
22919
  },
22839
22920
  semantic_index: {
22840
22921
  status: readString(semanticIndex.status, "unknown"),
22922
+ backend: readNullableString(semanticIndex.backend ?? semanticConfig.backend),
22923
+ model: readNullableString(semanticIndex.model ?? semanticConfig.model),
22924
+ stage: readNullableString(semanticIndex.stage),
22925
+ files: readOptionalNumber(semanticIndex.files),
22926
+ entries_done: readOptionalNumber(semanticIndex.entries_done),
22927
+ entries_total: readOptionalNumber(semanticIndex.entries_total),
22841
22928
  entries: readOptionalNumber(semanticIndex.entries),
22842
- dimension: readOptionalNumber(semanticIndex.dimension)
22929
+ dimension: readOptionalNumber(semanticIndex.dimension),
22930
+ error: readNullableString(semanticIndex.error)
22843
22931
  },
22844
22932
  disk: {
22845
22933
  storage_dir: readNullableString(disk.storage_dir),
@@ -22875,9 +22963,27 @@ function formatStatusMarkdown(status) {
22875
22963
  `- **Status:** \`${status.semantic_index.status}\``,
22876
22964
  `- **Entries:** ${formatCount(status.semantic_index.entries)}`
22877
22965
  ];
22966
+ if (status.semantic_index.backend) {
22967
+ lines.push(`- **Backend:** ${status.semantic_index.backend}`);
22968
+ }
22969
+ if (status.semantic_index.model) {
22970
+ lines.push(`- **Model:** ${status.semantic_index.model}`);
22971
+ }
22878
22972
  if (status.semantic_index.dimension != null) {
22879
22973
  lines.push(`- **Dimension:** ${formatCount(status.semantic_index.dimension)}`);
22880
22974
  }
22975
+ if (status.semantic_index.stage) {
22976
+ lines.push(`- **Stage:** ${status.semantic_index.stage}`);
22977
+ }
22978
+ if (status.semantic_index.files != null) {
22979
+ lines.push(`- **Files:** ${formatCount(status.semantic_index.files)}`);
22980
+ }
22981
+ if (status.semantic_index.entries_done != null || status.semantic_index.entries_total != null) {
22982
+ lines.push(`- **Progress:** ${formatCount(status.semantic_index.entries_done ?? null)} / ${formatCount(status.semantic_index.entries_total ?? null)}`);
22983
+ }
22984
+ if (status.semantic_index.error) {
22985
+ lines.push(`- **Error:** ${status.semantic_index.error}`);
22986
+ }
22881
22987
  lines.push("", "### Disk usage", `- **Trigram index:** ${formatBytes(status.disk.trigram_disk_bytes)}`, `- **Semantic index:** ${formatBytes(status.disk.semantic_disk_bytes)}`, "", "### Runtime", `- **LSP servers:** ${formatCount(status.lsp_servers)}`, `- **Symbol cache:** ${formatCount(status.symbol_cache.local_entries)} local / ${formatCount(status.symbol_cache.warm_entries)} warm`);
22882
22988
  if (status.storage_dir ?? status.disk.storage_dir) {
22883
22989
  lines.push(`- **Storage dir:** \`${status.storage_dir ?? status.disk.storage_dir}\``);
@@ -25270,9 +25376,12 @@ var plugin = async (input) => {
25270
25376
  configOverrides.experimental_search_index = aftConfig.experimental_search_index;
25271
25377
  if (aftConfig.experimental_semantic_search !== undefined)
25272
25378
  configOverrides.experimental_semantic_search = aftConfig.experimental_semantic_search;
25379
+ if (aftConfig.semantic !== undefined)
25380
+ configOverrides.semantic = aftConfig.semantic;
25381
+ const isFastembedSemanticBackend = (aftConfig.semantic?.backend ?? "fastembed") === "fastembed";
25273
25382
  const dataHome = process.env.XDG_DATA_HOME || join13(homedir7(), ".local", "share");
25274
25383
  configOverrides.storage_dir = join13(dataHome, "opencode", "storage", "plugin", "aft");
25275
- if (aftConfig.experimental_semantic_search) {
25384
+ if (aftConfig.experimental_semantic_search && isFastembedSemanticBackend) {
25276
25385
  const storageDir2 = configOverrides.storage_dir;
25277
25386
  ensureOnnxRuntime(storageDir2).then((ortDir) => {
25278
25387
  if (ortDir) {
@@ -25350,7 +25459,7 @@ var plugin = async (input) => {
25350
25459
  });
25351
25460
  rpcServer.handle("get-warnings", async () => {
25352
25461
  const warnings = [];
25353
- if (aftConfig.experimental_semantic_search && !configOverrides._ort_dylib_dir) {
25462
+ if (aftConfig.experimental_semantic_search && isFastembedSemanticBackend && !configOverrides._ort_dylib_dir) {
25354
25463
  if (!isOrtAutoDownloadSupported()) {
25355
25464
  warnings.push(`Semantic search requires ONNX Runtime.
25356
25465
  Install: ${getManualInstallHint()}`);
@@ -25372,7 +25481,7 @@ Install: ${getManualInstallHint()}`);
25372
25481
  setTimeout(() => {
25373
25482
  sendFeatureAnnouncement(notifyOpts, PLUGIN_VERSION, featureList, storageDir).catch(() => {});
25374
25483
  }, 8000);
25375
- if (aftConfig.experimental_semantic_search && !configOverrides._ort_dylib_dir) {
25484
+ if (aftConfig.experimental_semantic_search && isFastembedSemanticBackend && !configOverrides._ort_dylib_dir) {
25376
25485
  setTimeout(() => {
25377
25486
  if (!configOverrides._ort_dylib_dir && !isOrtAutoDownloadSupported()) {
25378
25487
  sendWarning(notifyOpts, `Semantic search requires ONNX Runtime.
@@ -15,8 +15,15 @@ export interface AftStatusSnapshot {
15
15
  };
16
16
  semantic_index: {
17
17
  status: string;
18
+ backend?: string | null;
19
+ model?: string | null;
20
+ stage?: string | null;
21
+ files?: number | null;
22
+ entries_done?: number | null;
23
+ entries_total?: number | null;
18
24
  entries: number | null;
19
25
  dimension: number | null;
26
+ error?: string | null;
20
27
  };
21
28
  disk: {
22
29
  storage_dir: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,wBAAwB,EAAE,OAAO,CAAC;QAClC,yBAAyB,EAAE,OAAO,CAAC;QACnC,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,cAAc,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC;IACF,IAAI,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I,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IACF,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAkCD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAkDpF;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA6D3E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA+DtE"}
package/dist/tui.js CHANGED
@@ -158,6 +158,10 @@ function coerceAftStatus(response) {
158
158
  const features = asRecord(response.features);
159
159
  const searchIndex = asRecord(response.search_index);
160
160
  const semanticIndex = asRecord(response.semantic_index);
161
+ const semanticConfig = {
162
+ ...asRecord(response.semantic),
163
+ ...asRecord(response.semantic_config)
164
+ };
161
165
  const disk = asRecord(response.disk);
162
166
  const symbolCache = asRecord(response.symbol_cache);
163
167
  return {
@@ -177,8 +181,15 @@ function coerceAftStatus(response) {
177
181
  },
178
182
  semantic_index: {
179
183
  status: readString(semanticIndex.status, "unknown"),
184
+ backend: readNullableString(semanticIndex.backend ?? semanticConfig.backend),
185
+ model: readNullableString(semanticIndex.model ?? semanticConfig.model),
186
+ stage: readNullableString(semanticIndex.stage),
187
+ files: readOptionalNumber(semanticIndex.files),
188
+ entries_done: readOptionalNumber(semanticIndex.entries_done),
189
+ entries_total: readOptionalNumber(semanticIndex.entries_total),
180
190
  entries: readOptionalNumber(semanticIndex.entries),
181
- dimension: readOptionalNumber(semanticIndex.dimension)
191
+ dimension: readOptionalNumber(semanticIndex.dimension),
192
+ error: readNullableString(semanticIndex.error)
182
193
  },
183
194
  disk: {
184
195
  storage_dir: readNullableString(disk.storage_dir),
@@ -212,6 +223,12 @@ function formatStatusDialogMessage(status) {
212
223
  `- status: ${status.semantic_index.status}`,
213
224
  `- entries: ${formatCount(status.semantic_index.entries)}`
214
225
  ];
226
+ if (status.semantic_index.backend) {
227
+ lines.push(`- backend: ${status.semantic_index.backend}`);
228
+ }
229
+ if (status.semantic_index.model) {
230
+ lines.push(`- model: ${status.semantic_index.model}`);
231
+ }
215
232
  if (status.semantic_index.dimension != null) {
216
233
  lines.push(`- dimension: ${formatCount(status.semantic_index.dimension)}`);
217
234
  }
@@ -219,6 +236,18 @@ function formatStatusDialogMessage(status) {
219
236
  if (status.storage_dir ?? status.disk.storage_dir) {
220
237
  lines.push(`- storage dir: ${status.storage_dir ?? status.disk.storage_dir}`);
221
238
  }
239
+ if (status.semantic_index.stage) {
240
+ lines.push("", "Semantic stage", status.semantic_index.stage);
241
+ }
242
+ if (status.semantic_index.files != null) {
243
+ lines.push(`- semantic files: ${formatCount(status.semantic_index.files)}`);
244
+ }
245
+ if (status.semantic_index.entries_done != null || status.semantic_index.entries_total != null) {
246
+ lines.push(`- semantic progress: ${formatCount(status.semantic_index.entries_done ?? null)} / ${formatCount(status.semantic_index.entries_total ?? null)}`);
247
+ }
248
+ if (status.semantic_index.error) {
249
+ lines.push("", "Semantic error", status.semantic_index.error);
250
+ }
222
251
  return lines.join(`
223
252
  `);
224
253
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-opencode",
3
- "version": "0.12.2",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
6
6
  "main": "dist/index.js",
@@ -35,11 +35,11 @@
35
35
  "zod": "^4.1.8"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@cortexkit/aft-darwin-arm64": "0.12.2",
39
- "@cortexkit/aft-darwin-x64": "0.12.2",
40
- "@cortexkit/aft-linux-arm64": "0.12.2",
41
- "@cortexkit/aft-linux-x64": "0.12.2",
42
- "@cortexkit/aft-win32-x64": "0.12.2"
38
+ "@cortexkit/aft-darwin-arm64": "0.13.1",
39
+ "@cortexkit/aft-darwin-x64": "0.13.1",
40
+ "@cortexkit/aft-linux-arm64": "0.13.1",
41
+ "@cortexkit/aft-linux-x64": "0.13.1",
42
+ "@cortexkit/aft-win32-x64": "0.13.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^22.0.0",
@@ -15,8 +15,15 @@ export interface AftStatusSnapshot {
15
15
  };
16
16
  semantic_index: {
17
17
  status: string;
18
+ backend?: string | null;
19
+ model?: string | null;
20
+ stage?: string | null;
21
+ files?: number | null;
22
+ entries_done?: number | null;
23
+ entries_total?: number | null;
18
24
  entries: number | null;
19
25
  dimension: number | null;
26
+ error?: string | null;
20
27
  };
21
28
  disk: {
22
29
  storage_dir: string | null;
@@ -82,6 +89,10 @@ export function coerceAftStatus(response: Record<string, unknown>): AftStatusSna
82
89
  const features = asRecord(response.features);
83
90
  const searchIndex = asRecord(response.search_index);
84
91
  const semanticIndex = asRecord(response.semantic_index);
92
+ const semanticConfig = {
93
+ ...asRecord(response.semantic),
94
+ ...asRecord((response as { semantic_config?: unknown }).semantic_config),
95
+ };
85
96
  const disk = asRecord(response.disk);
86
97
  const symbolCache = asRecord(response.symbol_cache);
87
98
 
@@ -102,8 +113,15 @@ export function coerceAftStatus(response: Record<string, unknown>): AftStatusSna
102
113
  },
103
114
  semantic_index: {
104
115
  status: readString(semanticIndex.status, "unknown"),
116
+ backend: readNullableString(semanticIndex.backend ?? semanticConfig.backend),
117
+ model: readNullableString(semanticIndex.model ?? semanticConfig.model),
118
+ stage: readNullableString(semanticIndex.stage),
119
+ files: readOptionalNumber(semanticIndex.files),
120
+ entries_done: readOptionalNumber(semanticIndex.entries_done),
121
+ entries_total: readOptionalNumber(semanticIndex.entries_total),
105
122
  entries: readOptionalNumber(semanticIndex.entries),
106
123
  dimension: readOptionalNumber(semanticIndex.dimension),
124
+ error: readNullableString(semanticIndex.error),
107
125
  },
108
126
  disk: {
109
127
  storage_dir: readNullableString(disk.storage_dir),
@@ -138,6 +156,12 @@ export function formatStatusDialogMessage(status: AftStatusSnapshot): string {
138
156
  `- status: ${status.semantic_index.status}`,
139
157
  `- entries: ${formatCount(status.semantic_index.entries)}`,
140
158
  ];
159
+ if (status.semantic_index.backend) {
160
+ lines.push(`- backend: ${status.semantic_index.backend}`);
161
+ }
162
+ if (status.semantic_index.model) {
163
+ lines.push(`- model: ${status.semantic_index.model}`);
164
+ }
141
165
 
142
166
  if (status.semantic_index.dimension != null) {
143
167
  lines.push(`- dimension: ${formatCount(status.semantic_index.dimension)}`);
@@ -158,6 +182,21 @@ export function formatStatusDialogMessage(status: AftStatusSnapshot): string {
158
182
  lines.push(`- storage dir: ${status.storage_dir ?? status.disk.storage_dir}`);
159
183
  }
160
184
 
185
+ if (status.semantic_index.stage) {
186
+ lines.push("", "Semantic stage", status.semantic_index.stage);
187
+ }
188
+ if (status.semantic_index.files != null) {
189
+ lines.push(`- semantic files: ${formatCount(status.semantic_index.files)}`);
190
+ }
191
+ if (status.semantic_index.entries_done != null || status.semantic_index.entries_total != null) {
192
+ lines.push(
193
+ `- semantic progress: ${formatCount(status.semantic_index.entries_done ?? null)} / ${formatCount(status.semantic_index.entries_total ?? null)}`,
194
+ );
195
+ }
196
+ if (status.semantic_index.error) {
197
+ lines.push("", "Semantic error", status.semantic_index.error);
198
+ }
199
+
161
200
  return lines.join("\n");
162
201
  }
163
202
 
@@ -182,10 +221,31 @@ export function formatStatusMarkdown(status: AftStatusSnapshot): string {
182
221
  `- **Status:** \`${status.semantic_index.status}\``,
183
222
  `- **Entries:** ${formatCount(status.semantic_index.entries)}`,
184
223
  ];
224
+ if (status.semantic_index.backend) {
225
+ lines.push(`- **Backend:** ${status.semantic_index.backend}`);
226
+ }
227
+ if (status.semantic_index.model) {
228
+ lines.push(`- **Model:** ${status.semantic_index.model}`);
229
+ }
185
230
 
186
231
  if (status.semantic_index.dimension != null) {
187
232
  lines.push(`- **Dimension:** ${formatCount(status.semantic_index.dimension)}`);
188
233
  }
234
+ if (status.semantic_index.stage) {
235
+ lines.push(`- **Stage:** ${status.semantic_index.stage}`);
236
+ }
237
+ if (status.semantic_index.files != null) {
238
+ lines.push(`- **Files:** ${formatCount(status.semantic_index.files)}`);
239
+ }
240
+ if (status.semantic_index.entries_done != null || status.semantic_index.entries_total != null) {
241
+ lines.push(
242
+ `- **Progress:** ${formatCount(status.semantic_index.entries_done ?? null)} / ${formatCount(status.semantic_index.entries_total ?? null)}`,
243
+ );
244
+ }
245
+
246
+ if (status.semantic_index.error) {
247
+ lines.push(`- **Error:** ${status.semantic_index.error}`);
248
+ }
189
249
 
190
250
  lines.push(
191
251
  "",