@cortexkit/aft-opencode 0.19.4 → 0.19.6

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.
@@ -4,7 +4,22 @@ interface AutoUpdateInstallContext {
4
4
  }
5
5
  export declare function resolveInstallContext(runtimePackageJsonPath?: string | null): AutoUpdateInstallContext | null;
6
6
  export declare function preparePackageUpdate(version: string, packageName?: string, runtimePackageJsonPath?: string | null): string | null;
7
- export declare function runBunInstallSafe(installDir: string, options?: {
7
+ /**
8
+ * Run `npm install` in the install dir to materialize the dependency version
9
+ * we just rewrote into package.json. Earlier versions used `bun install`,
10
+ * but OpenCode itself installs plugins via npm — the install dir always
11
+ * contains `package-lock.json`, never `bun.lock` — so calling npm matches
12
+ * the existing lockfile shape and avoids generating a parallel bun.lock
13
+ * that drifts from OpenCode's view.
14
+ *
15
+ * `--no-audit --no-fund --no-progress` keeps the output minimal and avoids
16
+ * noisy network calls during background auto-updates.
17
+ *
18
+ * The default timeout is 60s — long enough for a typical reinstall over a
19
+ * mediocre network, short enough that a stuck install doesn't pin the plugin
20
+ * process. Caller can override.
21
+ */
22
+ export declare function runNpmInstallSafe(installDir: string, options?: {
8
23
  timeoutMs?: number;
9
24
  signal?: AbortSignal;
10
25
  }): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAmBA,UAAU,wBAAwB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB;AA4ED,wBAAgB,qBAAqB,CACnC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GACzE,wBAAwB,GAAG,IAAI,CAoBjC;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GACzE,MAAM,GAAG,IAAI,CAwBf;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACzD,OAAO,CAAC,OAAO,CAAC,CAyClB"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAoBA,UAAU,wBAAwB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB;AA4FD,wBAAgB,qBAAqB,CACnC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GACzE,wBAAwB,GAAG,IAAI,CAoBjC;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GACzE,MAAM,GAAG,IAAI,CAwBf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACzD,OAAO,CAAC,OAAO,CAAC,CAyClB"}
package/dist/index.js CHANGED
@@ -8675,6 +8675,46 @@ function cleanupAbandonedOnnxAttempts(onnxBaseDir, ortDir) {
8675
8675
  warn(`[onnx] failed to sweep ${ortDir}: ${err}`);
8676
8676
  }
8677
8677
  }
8678
+ var REQUIRED_ORT_MAJOR = 1;
8679
+ var REQUIRED_ORT_MIN_MINOR = 20;
8680
+ function detectOnnxVersion(libDir, libName) {
8681
+ try {
8682
+ const entries = readdirSync(libDir);
8683
+ const barePrefix = libName.replace(/\.(so|dylib|dll)$/, "");
8684
+ for (const entry of entries) {
8685
+ if (!entry.startsWith(barePrefix))
8686
+ continue;
8687
+ const match = entry.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
8688
+ if (match)
8689
+ return match[1];
8690
+ }
8691
+ const base = join3(libDir, libName);
8692
+ if (existsSync2(base)) {
8693
+ try {
8694
+ const real = realpathSync(base);
8695
+ const m = real.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
8696
+ if (m)
8697
+ return m[1];
8698
+ } catch {}
8699
+ try {
8700
+ const target = readlinkSync(base);
8701
+ const m = target.match(/\.(\d+\.\d+\.\d+)(?:\.dylib)?$/);
8702
+ if (m)
8703
+ return m[1];
8704
+ } catch {}
8705
+ }
8706
+ } catch {}
8707
+ return null;
8708
+ }
8709
+ function isOnnxVersionCompatible(version) {
8710
+ const parts = version.split(".").map((p) => Number.parseInt(p, 10));
8711
+ const [major, minor] = parts;
8712
+ if (!Number.isFinite(major) || !Number.isFinite(minor))
8713
+ return false;
8714
+ if (major !== REQUIRED_ORT_MAJOR)
8715
+ return false;
8716
+ return minor >= REQUIRED_ORT_MIN_MINOR;
8717
+ }
8678
8718
  function findSystemOnnxRuntime(libName) {
8679
8719
  if (!libName)
8680
8720
  return null;
@@ -8685,9 +8725,14 @@ function findSystemOnnxRuntime(libName) {
8685
8725
  searchPaths.push("/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib/aarch64-linux-gnu", "/usr/local/lib");
8686
8726
  }
8687
8727
  for (const dir of searchPaths) {
8688
- if (existsSync2(join3(dir, libName))) {
8689
- return dir;
8728
+ if (!existsSync2(join3(dir, libName)))
8729
+ continue;
8730
+ const version = detectOnnxVersion(dir, libName);
8731
+ if (version && !isOnnxVersionCompatible(version)) {
8732
+ warn(`Skipping system ONNX Runtime at ${dir} (v${version}); AFT requires ` + `v${REQUIRED_ORT_MAJOR}.${REQUIRED_ORT_MIN_MINOR}+. Falling through to AFT-managed download.`);
8733
+ continue;
8690
8734
  }
8735
+ return dir;
8691
8736
  }
8692
8737
  return null;
8693
8738
  }
@@ -24368,24 +24413,27 @@ function stripPackageNameFromPath(pathValue, packageName) {
24368
24413
  }
24369
24414
  return current;
24370
24415
  }
24371
- function removeFromBunLock(installDir, packageName) {
24372
- const lockPath = join10(installDir, "bun.lock");
24416
+ function removeFromPackageLock(installDir, packageName) {
24417
+ const lockPath = join10(installDir, "package-lock.json");
24373
24418
  if (!existsSync7(lockPath))
24374
24419
  return false;
24375
24420
  try {
24376
24421
  const lock = import_comment_json3.parse(readFileSync5(lockPath, "utf-8"));
24377
24422
  let modified = false;
24378
- if (lock.workspaces?.[""]?.dependencies?.[packageName]) {
24379
- delete lock.workspaces[""].dependencies[packageName];
24380
- modified = true;
24423
+ if (lock.packages) {
24424
+ const key = `node_modules/${packageName}`;
24425
+ if (lock.packages[key] !== undefined) {
24426
+ delete lock.packages[key];
24427
+ modified = true;
24428
+ }
24381
24429
  }
24382
- if (lock.packages?.[packageName]) {
24383
- delete lock.packages[packageName];
24430
+ if (lock.dependencies?.[packageName]) {
24431
+ delete lock.dependencies[packageName];
24384
24432
  modified = true;
24385
24433
  }
24386
24434
  if (modified) {
24387
24435
  writeFileSync5(lockPath, JSON.stringify(lock, null, 2));
24388
- log2(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
24436
+ log2(`[auto-update-checker] Removed from package-lock.json: ${packageName}`);
24389
24437
  }
24390
24438
  return modified;
24391
24439
  } catch {
@@ -24450,7 +24498,7 @@ function preparePackageUpdate(version2, packageName = PACKAGE_NAME, runtimePacka
24450
24498
  if (!ensureDependencyVersion(installContext.packageJsonPath, packageName, version2))
24451
24499
  return null;
24452
24500
  const packageRemoved = removeInstalledPackage(installContext.installDir, packageName);
24453
- const lockRemoved = removeFromBunLock(installContext.installDir, packageName);
24501
+ const lockRemoved = removeFromPackageLock(installContext.installDir, packageName);
24454
24502
  if (!packageRemoved && !lockRemoved) {
24455
24503
  log2(`[auto-update-checker] No cached package artifacts removed for ${packageName}; continuing with updated dependency spec`);
24456
24504
  }
@@ -24460,12 +24508,12 @@ function preparePackageUpdate(version2, packageName = PACKAGE_NAME, runtimePacka
24460
24508
  return null;
24461
24509
  }
24462
24510
  }
24463
- async function runBunInstallSafe(installDir, options = {}) {
24511
+ async function runNpmInstallSafe(installDir, options = {}) {
24464
24512
  let timeout = null;
24465
24513
  try {
24466
24514
  if (options.signal?.aborted)
24467
24515
  return false;
24468
- const proc = spawn2("bun", ["install"], {
24516
+ const proc = spawn2("npm", ["install", "--no-audit", "--no-fund", "--no-progress"], {
24469
24517
  cwd: installDir,
24470
24518
  stdio: "pipe"
24471
24519
  });
@@ -24490,7 +24538,7 @@ async function runBunInstallSafe(installDir, options = {}) {
24490
24538
  }
24491
24539
  return result;
24492
24540
  } catch (err) {
24493
- warn2(`[auto-update-checker] bun install error: ${String(err)}`);
24541
+ warn2(`[auto-update-checker] npm install error: ${String(err)}`);
24494
24542
  return false;
24495
24543
  } finally {
24496
24544
  if (timeout)
@@ -24605,7 +24653,7 @@ async function runBackgroundUpdateCheck(ctx, options) {
24605
24653
  warn2("[auto-update-checker] Failed to prepare install root for auto-update");
24606
24654
  return;
24607
24655
  }
24608
- const installSuccess = await runBunInstallSafe(installDir, { signal: options.signal });
24656
+ const installSuccess = await runNpmInstallSafe(installDir, { signal: options.signal });
24609
24657
  if (installSuccess) {
24610
24658
  showToast(ctx, "AFT Updated!", `v${currentVersion} \u2192 v${latestVersion}
24611
24659
  Restart OpenCode to apply.`, "success", 8000);
@@ -24613,7 +24661,7 @@ Restart OpenCode to apply.`, "success", 8000);
24613
24661
  return;
24614
24662
  }
24615
24663
  showToast(ctx, `AFT ${latestVersion}`, `v${latestVersion} available, but auto-update failed to install it. Check logs or retry manually.`, "error", 8000);
24616
- warn2("[auto-update-checker] bun install failed; update not installed");
24664
+ warn2("[auto-update-checker] npm install failed; update not installed");
24617
24665
  }
24618
24666
  function showToast(ctx, title, message, variant = "info", duration3 = 3000) {
24619
24667
  ctx.client.tui.showToast({ body: { title, message, variant, duration: duration3 } }).catch(() => {});
@@ -26903,6 +26951,10 @@ async function callBridge(ctx, runtime, command, params = {}, options) {
26903
26951
 
26904
26952
  // src/tools/permissions.ts
26905
26953
  import * as path3 from "path";
26954
+ import { Effect } from "effect";
26955
+ async function runAsk(maybe) {
26956
+ await Effect.runPromise(maybe);
26957
+ }
26906
26958
  function resolveAbsolutePath(context, target) {
26907
26959
  return path3.isAbsolute(target) ? target : path3.resolve(context.directory, target);
26908
26960
  }
@@ -26928,12 +26980,12 @@ function workspacePattern(_context) {
26928
26980
  }
26929
26981
  async function askEditPermission(context, patterns, metadata = {}) {
26930
26982
  try {
26931
- await context.ask({
26983
+ await runAsk(context.ask({
26932
26984
  permission: "edit",
26933
26985
  patterns: patterns.length > 0 ? patterns : [workspacePattern(context)],
26934
26986
  always: ["*"],
26935
26987
  metadata
26936
- });
26988
+ }));
26937
26989
  return;
26938
26990
  } catch (error50) {
26939
26991
  if (error50 instanceof Error && error50.message) {
@@ -26957,23 +27009,9 @@ function showOutputToUser(context, output) {
26957
27009
  const ctx = context;
26958
27010
  ctx.metadata?.({ metadata: { output } });
26959
27011
  }
26960
- function getEmptyResultHint(pattern, lang) {
26961
- const src = pattern.trim();
26962
- if (lang === "python") {
26963
- if (src.startsWith("class ") && src.endsWith(":")) {
26964
- return `Hint: Python class patterns need a body. Try: "${src.slice(0, -1)}" or "${src}
26965
- $$$"`;
26966
- }
26967
- if ((src.startsWith("def ") || src.startsWith("async def ")) && src.endsWith(":")) {
26968
- return `Hint: Python function patterns need a body. Try adding "\\n $$$" after the colon.`;
26969
- }
26970
- }
26971
- if (["javascript", "typescript", "tsx"].includes(lang)) {
26972
- if (/^(export\s+)?(async\s+)?function\s+\$[A-Z_]+\s*$/i.test(src)) {
26973
- return `Hint: Function patterns need params and body. Try: "function $NAME($$$) { $$$ }"`;
26974
- }
26975
- }
26976
- return null;
27012
+ function extractHint(response) {
27013
+ const hint = response.hint;
27014
+ return typeof hint === "string" && hint.length > 0 ? hint : null;
26977
27015
  }
26978
27016
  var SUPPORTED_LANGS = ["typescript", "tsx", "javascript", "python", "rust", "go"];
26979
27017
  function astTools(ctx) {
@@ -27032,7 +27070,7 @@ Scope warnings:
27032
27070
  ${data.scope_warnings.map((w) => ` ${w}`).join(`
27033
27071
  `)}`;
27034
27072
  }
27035
- const hint = getEmptyResultHint(args.pattern, args.lang);
27073
+ const hint = extractHint(response);
27036
27074
  if (hint) {
27037
27075
  output += `
27038
27076
 
@@ -27137,6 +27175,12 @@ Scope warnings:
27137
27175
  ${data.scope_warnings.map((w) => ` ${w}`).join(`
27138
27176
  `)}`;
27139
27177
  }
27178
+ const hint = extractHint(response);
27179
+ if (hint) {
27180
+ output += `
27181
+
27182
+ ${hint}`;
27183
+ }
27140
27184
  } else {
27141
27185
  output = isDryRun ? `[DRY RUN] Would replace ${matchCount} match(es) in ${filesWithMatches} file(s) (${filesSearched} searched)
27142
27186
 
@@ -27535,12 +27579,12 @@ async function withPermissionLoop(ctx, runtime, params, bridgeCall, options) {
27535
27579
  const permissionsGranted = [];
27536
27580
  for (const ask of asks) {
27537
27581
  const permission = ask.kind === "external_directory" ? "external_directory" : "bash";
27538
- await runtime.ask({
27582
+ await runAsk(runtime.ask({
27539
27583
  permission,
27540
27584
  patterns: ask.patterns,
27541
27585
  always: ask.always,
27542
27586
  metadata: {}
27543
- });
27587
+ }));
27544
27588
  permissionsGranted.push(...ask.always.length > 0 ? ask.always : ask.patterns);
27545
27589
  }
27546
27590
  const second = await bridgeCall(ctx, runtime, "bash", { ...params, permissions_granted: permissionsGranted }, options);
@@ -27945,12 +27989,12 @@ function createReadTool(ctx) {
27945
27989
  execute: async (args, context) => {
27946
27990
  const file2 = args.filePath;
27947
27991
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
27948
- await context.ask({
27992
+ await runAsk(context.ask({
27949
27993
  permission: "read",
27950
27994
  patterns: [filePath],
27951
27995
  always: ["*"],
27952
27996
  metadata: {}
27953
- });
27997
+ }));
27954
27998
  const ext = path4.extname(filePath).toLowerCase();
27955
27999
  const mimeMap = {
27956
28000
  ".png": "image/png",
@@ -28069,12 +28113,12 @@ function createWriteTool(ctx, editToolName = "edit") {
28069
28113
  const content = args.content;
28070
28114
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28071
28115
  const relPath = path4.relative(context.worktree, filePath);
28072
- await context.ask({
28116
+ await runAsk(context.ask({
28073
28117
  permission: "edit",
28074
28118
  patterns: [relPath],
28075
28119
  always: ["*"],
28076
28120
  metadata: { filepath: filePath }
28077
- });
28121
+ }));
28078
28122
  const data = await callBridge(ctx, context, "write", {
28079
28123
  file: filePath,
28080
28124
  content,
@@ -28219,12 +28263,12 @@ function createEditTool(ctx, writeToolName = "write") {
28219
28263
  if (Array.isArray(args.operations)) {
28220
28264
  const ops = args.operations;
28221
28265
  const files = ops.map((op) => op.file).filter(Boolean);
28222
- await context.ask({
28266
+ await runAsk(context.ask({
28223
28267
  permission: "edit",
28224
28268
  patterns: files.map((f) => path4.relative(context.worktree, path4.resolve(context.directory, f))),
28225
28269
  always: ["*"],
28226
28270
  metadata: {}
28227
- });
28271
+ }));
28228
28272
  const resolvedOps = ops.map((op) => ({
28229
28273
  ...op,
28230
28274
  file: path4.isAbsolute(op.file) ? op.file : path4.resolve(context.directory, op.file)
@@ -28239,12 +28283,12 @@ function createEditTool(ctx, writeToolName = "write") {
28239
28283
  throw new Error("'filePath' parameter is required");
28240
28284
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28241
28285
  const relPath = path4.relative(context.worktree, filePath);
28242
- await context.ask({
28286
+ await runAsk(context.ask({
28243
28287
  permission: "edit",
28244
28288
  patterns: [relPath],
28245
28289
  always: ["*"],
28246
28290
  metadata: { filepath: filePath }
28247
- });
28291
+ }));
28248
28292
  const params = { file: filePath };
28249
28293
  let command;
28250
28294
  if (typeof args.appendContent === "string") {
@@ -28441,12 +28485,12 @@ function createApplyPatchTool(ctx) {
28441
28485
  }
28442
28486
  const relPaths = Array.from(affectedAbs).map((abs) => path4.relative(context.worktree, abs));
28443
28487
  const multiFileWritePaths = Array.from(affectedAbs);
28444
- await context.ask({
28488
+ await runAsk(context.ask({
28445
28489
  permission: "edit",
28446
28490
  patterns: relPaths,
28447
28491
  always: ["*"],
28448
28492
  metadata: {}
28449
- });
28493
+ }));
28450
28494
  const checkpointPaths = Array.from(affectedAbs).filter((abs) => !newlyCreatedAbs.has(abs));
28451
28495
  const checkpointName = `apply_patch_${Date.now()}`;
28452
28496
  let checkpointCreated = false;
@@ -28676,12 +28720,12 @@ function createDeleteTool(ctx) {
28676
28720
  execute: async (args, context) => {
28677
28721
  const inputs = args.files;
28678
28722
  const absolutePaths = inputs.map((f) => path4.isAbsolute(f) ? f : path4.resolve(context.directory, f));
28679
- await context.ask({
28723
+ await runAsk(context.ask({
28680
28724
  permission: "edit",
28681
28725
  patterns: absolutePaths,
28682
28726
  always: ["*"],
28683
28727
  metadata: { action: "delete", count: absolutePaths.length }
28684
- });
28728
+ }));
28685
28729
  const deleted = [];
28686
28730
  const skipped = [];
28687
28731
  for (const filePath of absolutePaths) {
@@ -28721,12 +28765,12 @@ function createMoveTool(ctx) {
28721
28765
  execute: async (args, context) => {
28722
28766
  const filePath = path4.isAbsolute(args.filePath) ? args.filePath : path4.resolve(context.directory, args.filePath);
28723
28767
  const destPath = path4.isAbsolute(args.destination) ? args.destination : path4.resolve(context.directory, args.destination);
28724
- await context.ask({
28768
+ await runAsk(context.ask({
28725
28769
  permission: "edit",
28726
28770
  patterns: [filePath, destPath],
28727
28771
  always: ["*"],
28728
28772
  metadata: { action: "move" }
28729
- });
28773
+ }));
28730
28774
  const result = await callBridge(ctx, context, "move_file", {
28731
28775
  file: filePath,
28732
28776
  destination: destPath
@@ -28777,12 +28821,12 @@ function aftPrefixedTools(ctx) {
28777
28821
  const file2 = normalizedArgs.filePath;
28778
28822
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28779
28823
  const relPath = path4.relative(context.worktree, filePath);
28780
- await context.ask({
28824
+ await runAsk(context.ask({
28781
28825
  permission: "edit",
28782
28826
  patterns: [relPath],
28783
28827
  always: ["*"],
28784
28828
  metadata: { filepath: filePath }
28785
- });
28829
+ }));
28786
28830
  const writeParams = {
28787
28831
  file: filePath,
28788
28832
  content: normalizedArgs.content,
@@ -28897,7 +28941,7 @@ function lspTools(ctx) {
28897
28941
  ` + `
28898
28942
  ` + `**Reading the response honestly:**
28899
28943
  ` + "- `total: 0, complete: true, lsp_servers_used: [{status: 'pull_ok'}]` \u2192 file is genuinely clean.\n" + "- `total: 0, lsp_servers_used: []` \u2192 **nothing was checked** (no server registered for this extension). Tell the user, don't claim 'no errors'.\n" + "- `lsp_servers_used: [{status: 'binary_not_installed: <name>'}]` \u2192 server matched the extension but its binary isn't on PATH. Tell the user to install it.\n" + "- `lsp_servers_used: [{status: 'no_root_marker (...)'}]` \u2192 server is registered but couldn't find a workspace root marker walking up from this file. The user's project layout doesn't match what the server expects.\n" + "- `complete: false` (directory mode) \u2192 some files in the directory weren't checked; see `unchecked_files`.\n" + `
28900
- ` + "**When this tool gives an unhelpful answer**, run `bunx --bun @cortexkit/aft doctor lsp <filePath>` from a terminal to get a full per-server breakdown (registered servers, binary resolution, root-marker resolution, spawn outcome).",
28944
+ ` + "**When this tool gives an unhelpful answer**, run `npx @cortexkit/aft doctor lsp <filePath>` from a terminal to get a full per-server breakdown (registered servers, binary resolution, root-marker resolution, spawn outcome).",
28901
28945
  args: {
28902
28946
  filePath: z6.string().optional().describe("Path to a file to check. Mutually exclusive with 'directory'. Omit both to dump all cached diagnostics."),
28903
28947
  directory: z6.string().optional().describe("Path to a directory. Returns cached diagnostics + workspace pull from active servers; lists files we have no info for in 'unchecked_files'. Capped at 200 walked files."),
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyCjD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAgR3E"}
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiCjD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA0R3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsDjD,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA6JjE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAqCvE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAmBrE"}
1
+ {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyDjD,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA6JjE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAqCvE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAmBrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"hoisted.d.ts","sourceRoot":"","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}
@@ -1,4 +1,25 @@
1
1
  import type { ToolContext } from "@opencode-ai/plugin";
2
+ import { Effect } from "effect";
3
+ /**
4
+ * Execute a `ctx.ask(...)` result.
5
+ *
6
+ * Why this exists: OpenCode's plugin contract returns `Effect.Effect<void>`
7
+ * from `ask()` (since v1.14). Plain `await effect` resolves silently to the
8
+ * Effect object without ever executing it — meaning the deny/ask evaluation
9
+ * never runs and the user's `bash: { "*": deny }` (and edit/external_directory)
10
+ * rules are silently ignored. The Effect must be run via `Effect.runPromise`.
11
+ *
12
+ * `effect` is marked external in our bun build and listed as a peerDependency,
13
+ * so this import resolves at runtime to the same `effect` runtime that
14
+ * `@opencode-ai/plugin` is using to construct the Effect. Bundling our own
15
+ * `effect` would create a runtime instance mismatch where
16
+ * `Effect.runPromise(...)` rejects with "Not a valid effect".
17
+ *
18
+ * On deny, `Effect.runPromise` rejects with the underlying defect
19
+ * (DeniedError / RejectedError) so callers can rely on `try/catch` to
20
+ * detect denial.
21
+ */
22
+ export declare function runAsk(maybe: Effect.Effect<void>): Promise<void>;
2
23
  export declare function resolveAbsolutePath(context: ToolContext, target: string): string;
3
24
  export declare function resolveRelativePattern(context: ToolContext, target: string): string;
4
25
  export declare function resolveRelativePatterns(context: ToolContext, targets: string[]): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAazF;AAED,wBAAgB,gBAAgB,CA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-2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "@cortexkit/aft-opencode",
5
- version: "0.19.4",
5
+ version: "0.19.6",
6
6
  type: "module",
7
7
  description: "OpenCode plugin for Agent File Tools (AFT) \u2014 tree-sitter and lsp powered code analysis",
8
8
  main: "dist/index.js",
@@ -20,7 +20,7 @@ var package_default = {
20
20
  "README.md"
21
21
  ],
22
22
  scripts: {
23
- build: "bun build src/index.ts --outdir dist --target bun --format esm --external @opencode-ai/plugin && bun build src/tui/index.tsx --outfile dist/tui.js --target bun --format esm --external @opencode-ai/plugin --external @opencode-ai/plugin/tui --external @opentui/solid --external solid-js && tsc --emitDeclarationOnly",
23
+ build: "bun build src/index.ts --outdir dist --target bun --format esm --external @opencode-ai/plugin --external effect && bun build src/tui/index.tsx --outfile dist/tui.js --target bun --format esm --external @opencode-ai/plugin --external @opencode-ai/plugin/tui --external @opentui/solid --external solid-js --external effect && tsc --emitDeclarationOnly",
24
24
  typecheck: "tsc --noEmit",
25
25
  pretest: "cd ../.. && cargo build",
26
26
  test: "bun test",
@@ -30,19 +30,19 @@ var package_default = {
30
30
  },
31
31
  dependencies: {
32
32
  "@clack/prompts": "^1.2.0",
33
- "@cortexkit/aft-bridge": "0.19.4",
34
- "@opencode-ai/plugin": "^1.2.26",
35
- "@opencode-ai/sdk": "^1.2.26",
33
+ "@cortexkit/aft-bridge": "0.19.6",
34
+ "@opencode-ai/plugin": "^1.14.39",
35
+ "@opencode-ai/sdk": "^1.14.39",
36
36
  "comment-json": "^4.6.2",
37
37
  undici: "^7.25.0",
38
38
  zod: "^4.1.8"
39
39
  },
40
40
  optionalDependencies: {
41
- "@cortexkit/aft-darwin-arm64": "0.19.4",
42
- "@cortexkit/aft-darwin-x64": "0.19.4",
43
- "@cortexkit/aft-linux-arm64": "0.19.4",
44
- "@cortexkit/aft-linux-x64": "0.19.4",
45
- "@cortexkit/aft-win32-x64": "0.19.4"
41
+ "@cortexkit/aft-darwin-arm64": "0.19.6",
42
+ "@cortexkit/aft-darwin-x64": "0.19.6",
43
+ "@cortexkit/aft-linux-arm64": "0.19.6",
44
+ "@cortexkit/aft-linux-x64": "0.19.6",
45
+ "@cortexkit/aft-win32-x64": "0.19.6"
46
46
  },
47
47
  devDependencies: {
48
48
  "@types/node": "^22.0.0",
@@ -63,7 +63,8 @@ var package_default = {
63
63
  "tui"
64
64
  ],
65
65
  peerDependencies: {
66
- "@opencode-ai/plugin": ">=1.2.0"
66
+ "@opencode-ai/plugin": ">=1.14.0",
67
+ effect: ">=4.0.0-beta.0"
67
68
  }
68
69
  };
69
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-opencode",
3
- "version": "0.19.4",
3
+ "version": "0.19.6",
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",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "scripts": {
21
- "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @opencode-ai/plugin && bun build src/tui/index.tsx --outfile dist/tui.js --target bun --format esm --external @opencode-ai/plugin --external @opencode-ai/plugin/tui --external @opentui/solid --external solid-js && tsc --emitDeclarationOnly",
21
+ "build": "bun build src/index.ts --outdir dist --target bun --format esm --external @opencode-ai/plugin --external effect && bun build src/tui/index.tsx --outfile dist/tui.js --target bun --format esm --external @opencode-ai/plugin --external @opencode-ai/plugin/tui --external @opentui/solid --external solid-js --external effect && tsc --emitDeclarationOnly",
22
22
  "typecheck": "tsc --noEmit",
23
23
  "pretest": "cd ../.. && cargo build",
24
24
  "test": "bun test",
@@ -28,19 +28,19 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^1.2.0",
31
- "@cortexkit/aft-bridge": "0.19.4",
32
- "@opencode-ai/plugin": "^1.2.26",
33
- "@opencode-ai/sdk": "^1.2.26",
31
+ "@cortexkit/aft-bridge": "0.19.6",
32
+ "@opencode-ai/plugin": "^1.14.39",
33
+ "@opencode-ai/sdk": "^1.14.39",
34
34
  "comment-json": "^4.6.2",
35
35
  "undici": "^7.25.0",
36
36
  "zod": "^4.1.8"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@cortexkit/aft-darwin-arm64": "0.19.4",
40
- "@cortexkit/aft-darwin-x64": "0.19.4",
41
- "@cortexkit/aft-linux-arm64": "0.19.4",
42
- "@cortexkit/aft-linux-x64": "0.19.4",
43
- "@cortexkit/aft-win32-x64": "0.19.4"
39
+ "@cortexkit/aft-darwin-arm64": "0.19.6",
40
+ "@cortexkit/aft-darwin-x64": "0.19.6",
41
+ "@cortexkit/aft-linux-arm64": "0.19.6",
42
+ "@cortexkit/aft-linux-x64": "0.19.6",
43
+ "@cortexkit/aft-win32-x64": "0.19.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^22.0.0",
@@ -61,6 +61,7 @@
61
61
  "tui"
62
62
  ],
63
63
  "peerDependencies": {
64
- "@opencode-ai/plugin": ">=1.2.0"
64
+ "@opencode-ai/plugin": ">=1.14.0",
65
+ "effect": ">=4.0.0-beta.0"
65
66
  }
66
67
  }