@cortexkit/aft-opencode 0.19.5 → 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.
package/dist/index.js CHANGED
@@ -26951,6 +26951,10 @@ async function callBridge(ctx, runtime, command, params = {}, options) {
26951
26951
 
26952
26952
  // src/tools/permissions.ts
26953
26953
  import * as path3 from "path";
26954
+ import { Effect } from "effect";
26955
+ async function runAsk(maybe) {
26956
+ await Effect.runPromise(maybe);
26957
+ }
26954
26958
  function resolveAbsolutePath(context, target) {
26955
26959
  return path3.isAbsolute(target) ? target : path3.resolve(context.directory, target);
26956
26960
  }
@@ -26976,12 +26980,12 @@ function workspacePattern(_context) {
26976
26980
  }
26977
26981
  async function askEditPermission(context, patterns, metadata = {}) {
26978
26982
  try {
26979
- await context.ask({
26983
+ await runAsk(context.ask({
26980
26984
  permission: "edit",
26981
26985
  patterns: patterns.length > 0 ? patterns : [workspacePattern(context)],
26982
26986
  always: ["*"],
26983
26987
  metadata
26984
- });
26988
+ }));
26985
26989
  return;
26986
26990
  } catch (error50) {
26987
26991
  if (error50 instanceof Error && error50.message) {
@@ -27575,12 +27579,12 @@ async function withPermissionLoop(ctx, runtime, params, bridgeCall, options) {
27575
27579
  const permissionsGranted = [];
27576
27580
  for (const ask of asks) {
27577
27581
  const permission = ask.kind === "external_directory" ? "external_directory" : "bash";
27578
- await runtime.ask({
27582
+ await runAsk(runtime.ask({
27579
27583
  permission,
27580
27584
  patterns: ask.patterns,
27581
27585
  always: ask.always,
27582
27586
  metadata: {}
27583
- });
27587
+ }));
27584
27588
  permissionsGranted.push(...ask.always.length > 0 ? ask.always : ask.patterns);
27585
27589
  }
27586
27590
  const second = await bridgeCall(ctx, runtime, "bash", { ...params, permissions_granted: permissionsGranted }, options);
@@ -27985,12 +27989,12 @@ function createReadTool(ctx) {
27985
27989
  execute: async (args, context) => {
27986
27990
  const file2 = args.filePath;
27987
27991
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
27988
- await context.ask({
27992
+ await runAsk(context.ask({
27989
27993
  permission: "read",
27990
27994
  patterns: [filePath],
27991
27995
  always: ["*"],
27992
27996
  metadata: {}
27993
- });
27997
+ }));
27994
27998
  const ext = path4.extname(filePath).toLowerCase();
27995
27999
  const mimeMap = {
27996
28000
  ".png": "image/png",
@@ -28109,12 +28113,12 @@ function createWriteTool(ctx, editToolName = "edit") {
28109
28113
  const content = args.content;
28110
28114
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28111
28115
  const relPath = path4.relative(context.worktree, filePath);
28112
- await context.ask({
28116
+ await runAsk(context.ask({
28113
28117
  permission: "edit",
28114
28118
  patterns: [relPath],
28115
28119
  always: ["*"],
28116
28120
  metadata: { filepath: filePath }
28117
- });
28121
+ }));
28118
28122
  const data = await callBridge(ctx, context, "write", {
28119
28123
  file: filePath,
28120
28124
  content,
@@ -28259,12 +28263,12 @@ function createEditTool(ctx, writeToolName = "write") {
28259
28263
  if (Array.isArray(args.operations)) {
28260
28264
  const ops = args.operations;
28261
28265
  const files = ops.map((op) => op.file).filter(Boolean);
28262
- await context.ask({
28266
+ await runAsk(context.ask({
28263
28267
  permission: "edit",
28264
28268
  patterns: files.map((f) => path4.relative(context.worktree, path4.resolve(context.directory, f))),
28265
28269
  always: ["*"],
28266
28270
  metadata: {}
28267
- });
28271
+ }));
28268
28272
  const resolvedOps = ops.map((op) => ({
28269
28273
  ...op,
28270
28274
  file: path4.isAbsolute(op.file) ? op.file : path4.resolve(context.directory, op.file)
@@ -28279,12 +28283,12 @@ function createEditTool(ctx, writeToolName = "write") {
28279
28283
  throw new Error("'filePath' parameter is required");
28280
28284
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28281
28285
  const relPath = path4.relative(context.worktree, filePath);
28282
- await context.ask({
28286
+ await runAsk(context.ask({
28283
28287
  permission: "edit",
28284
28288
  patterns: [relPath],
28285
28289
  always: ["*"],
28286
28290
  metadata: { filepath: filePath }
28287
- });
28291
+ }));
28288
28292
  const params = { file: filePath };
28289
28293
  let command;
28290
28294
  if (typeof args.appendContent === "string") {
@@ -28481,12 +28485,12 @@ function createApplyPatchTool(ctx) {
28481
28485
  }
28482
28486
  const relPaths = Array.from(affectedAbs).map((abs) => path4.relative(context.worktree, abs));
28483
28487
  const multiFileWritePaths = Array.from(affectedAbs);
28484
- await context.ask({
28488
+ await runAsk(context.ask({
28485
28489
  permission: "edit",
28486
28490
  patterns: relPaths,
28487
28491
  always: ["*"],
28488
28492
  metadata: {}
28489
- });
28493
+ }));
28490
28494
  const checkpointPaths = Array.from(affectedAbs).filter((abs) => !newlyCreatedAbs.has(abs));
28491
28495
  const checkpointName = `apply_patch_${Date.now()}`;
28492
28496
  let checkpointCreated = false;
@@ -28716,12 +28720,12 @@ function createDeleteTool(ctx) {
28716
28720
  execute: async (args, context) => {
28717
28721
  const inputs = args.files;
28718
28722
  const absolutePaths = inputs.map((f) => path4.isAbsolute(f) ? f : path4.resolve(context.directory, f));
28719
- await context.ask({
28723
+ await runAsk(context.ask({
28720
28724
  permission: "edit",
28721
28725
  patterns: absolutePaths,
28722
28726
  always: ["*"],
28723
28727
  metadata: { action: "delete", count: absolutePaths.length }
28724
- });
28728
+ }));
28725
28729
  const deleted = [];
28726
28730
  const skipped = [];
28727
28731
  for (const filePath of absolutePaths) {
@@ -28761,12 +28765,12 @@ function createMoveTool(ctx) {
28761
28765
  execute: async (args, context) => {
28762
28766
  const filePath = path4.isAbsolute(args.filePath) ? args.filePath : path4.resolve(context.directory, args.filePath);
28763
28767
  const destPath = path4.isAbsolute(args.destination) ? args.destination : path4.resolve(context.directory, args.destination);
28764
- await context.ask({
28768
+ await runAsk(context.ask({
28765
28769
  permission: "edit",
28766
28770
  patterns: [filePath, destPath],
28767
28771
  always: ["*"],
28768
28772
  metadata: { action: "move" }
28769
- });
28773
+ }));
28770
28774
  const result = await callBridge(ctx, context, "move_file", {
28771
28775
  file: filePath,
28772
28776
  destination: destPath
@@ -28817,12 +28821,12 @@ function aftPrefixedTools(ctx) {
28817
28821
  const file2 = normalizedArgs.filePath;
28818
28822
  const filePath = path4.isAbsolute(file2) ? file2 : path4.resolve(context.directory, file2);
28819
28823
  const relPath = path4.relative(context.worktree, filePath);
28820
- await context.ask({
28824
+ await runAsk(context.ask({
28821
28825
  permission: "edit",
28822
28826
  patterns: [relPath],
28823
28827
  always: ["*"],
28824
28828
  metadata: { filepath: filePath }
28825
- });
28829
+ }));
28826
28830
  const writeParams = {
28827
28831
  file: filePath,
28828
28832
  content: normalizedArgs.content,
@@ -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":"","sources":["../../src/tools/hoisted.ts"],"names":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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,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAE9D;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhE"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtE;AAED,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,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAE9D;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiB7B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhE"}
package/dist/tui.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "@cortexkit/aft-opencode",
5
- version: "0.19.5",
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.5",
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.5",
42
- "@cortexkit/aft-darwin-x64": "0.19.5",
43
- "@cortexkit/aft-linux-arm64": "0.19.5",
44
- "@cortexkit/aft-linux-x64": "0.19.5",
45
- "@cortexkit/aft-win32-x64": "0.19.5"
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.5",
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.5",
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.5",
40
- "@cortexkit/aft-darwin-x64": "0.19.5",
41
- "@cortexkit/aft-linux-arm64": "0.19.5",
42
- "@cortexkit/aft-linux-x64": "0.19.5",
43
- "@cortexkit/aft-win32-x64": "0.19.5"
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
  }