@cortexkit/aft-opencode 0.23.0 → 0.25.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.
@@ -39,7 +39,6 @@ interface DrainContext {
39
39
  ctx: PluginContext;
40
40
  directory: string;
41
41
  sessionID: string;
42
- isActive?: () => boolean;
43
42
  }
44
43
  export declare function trackBgTask(sessionID: string | undefined, taskId: string): void;
45
44
  export declare function ingestBgCompletions(sessionID: string | undefined, completions: unknown): BgCompletion[];
@@ -1 +1 @@
1
- {"version":3,"file":"bg-notifications.d.ts","sourceRoot":"","sources":["../src/bg-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,cAAc,GAAG;IACpB,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,kBAAkB,EAAE,YAAY,EAAE,CAAC;IACnC,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACrC,iBAAiB,EAAE,MAAM,GAA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AO,CAAC,IAAI,CAAC,CAgCf;AAED,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,YAAY,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAC/C,OAAO,CAAC,IAAI,CAAC,CAEf;AAiED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CASjF;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAAG,MAAM,CAQ7F;AAWD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAcnE;AAED,wBAAgB,kCAAkC,IAAI,IAAI,CAKzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA8JlD;;;;;;;;;;;;;;;;;;GAkBG;AAQH,QAAA,MAAM,MAAM,EAAE,MAA6D,CAAC;AAwuB5E,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA8JlD;;;;;;;;;;;;;;;;;;GAkBG;AAQH,QAAA,MAAM,MAAM,EAAE,MAA6D,CAAC;AA4vB5E,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -7953,6 +7953,8 @@ class BinaryBridge {
7953
7953
  onConfigureWarnings;
7954
7954
  onBashCompletion;
7955
7955
  onBashLongRunning;
7956
+ cachedStatus = null;
7957
+ statusListeners = new Set;
7956
7958
  configureWarningClients = new Map;
7957
7959
  restartResetTimer = null;
7958
7960
  errorPrefix;
@@ -8001,6 +8003,21 @@ class BinaryBridge {
8001
8003
  hasPendingRequests() {
8002
8004
  return this.pending.size > 0;
8003
8005
  }
8006
+ getCachedStatus() {
8007
+ return this.cachedStatus;
8008
+ }
8009
+ subscribeStatus(listener) {
8010
+ this.statusListeners.add(listener);
8011
+ if (this.cachedStatus !== null) {
8012
+ this.deliverStatusSnapshot(listener, this.cachedStatus);
8013
+ }
8014
+ return () => {
8015
+ this.statusListeners.delete(listener);
8016
+ };
8017
+ }
8018
+ cacheStatusSnapshot(snapshot) {
8019
+ this.cachedStatus = snapshot;
8020
+ }
8004
8021
  async send(command, params = {}, options) {
8005
8022
  if (this._shuttingDown) {
8006
8023
  throw new Error(`${this.errorPrefix} Bridge is shutting down, cannot send "${command}"`);
@@ -8137,6 +8154,23 @@ class BinaryBridge {
8137
8154
  }
8138
8155
  }
8139
8156
  }
8157
+ handleStatusChangedFrame(frame) {
8158
+ const snapshot = frame.snapshot;
8159
+ if (!snapshot || typeof snapshot !== "object" || Array.isArray(snapshot))
8160
+ return;
8161
+ this.cachedStatus = snapshot;
8162
+ log("Received status_changed push frame; cached AFT status snapshot");
8163
+ for (const listener of this.statusListeners) {
8164
+ this.deliverStatusSnapshot(listener, this.cachedStatus);
8165
+ }
8166
+ }
8167
+ deliverStatusSnapshot(listener, snapshot) {
8168
+ try {
8169
+ listener(snapshot);
8170
+ } catch (err) {
8171
+ warn(`status listener threw: ${err instanceof Error ? err.message : String(err)}`);
8172
+ }
8173
+ }
8140
8174
  async shutdown() {
8141
8175
  this._shuttingDown = true;
8142
8176
  this.clearRestartResetTimer();
@@ -8341,6 +8375,10 @@ class BinaryBridge {
8341
8375
  });
8342
8376
  continue;
8343
8377
  }
8378
+ if (response.type === "status_changed") {
8379
+ this.handleStatusChangedFrame(response);
8380
+ continue;
8381
+ }
8344
8382
  const id = response.id;
8345
8383
  if (id && this.pending.has(id)) {
8346
8384
  const entry = this.pending.get(id);
@@ -10055,8 +10093,6 @@ async function handleIdleBgCompletions(drainContext) {
10055
10093
  }
10056
10094
  async function triggerWakeIfPending(drainContext, skipDrain) {
10057
10095
  const state = stateFor(drainContext.sessionID);
10058
- if (drainContext.isActive?.())
10059
- return;
10060
10096
  if (!skipDrain && state.outstandingTaskIds.size > 0) {
10061
10097
  await drainCompletions(drainContext);
10062
10098
  }
@@ -27096,6 +27132,8 @@ function coerceAftStatus(response) {
27096
27132
  return {
27097
27133
  version: readString(response.version, "unknown"),
27098
27134
  project_root: readNullableString(response.project_root),
27135
+ canonical_root: readNullableString(response.canonical_root),
27136
+ cache_role: readString(response.cache_role, "not_initialized"),
27099
27137
  features: {
27100
27138
  format_on_edit: readBoolean(features.format_on_edit),
27101
27139
  validate_on_edit: readString(features.validate_on_edit, "off"),
@@ -27145,6 +27183,8 @@ function formatStatusMarkdown(status) {
27145
27183
  "",
27146
27184
  `- **Version:** \`${status.version}\``,
27147
27185
  `- **Project root:** \`${status.project_root ?? "(not configured)"}\``,
27186
+ `- **Canonical root:** \`${status.canonical_root ?? "(not configured)"}\``,
27187
+ `- **Cache role:** \`${status.cache_role}\``,
27148
27188
  "",
27149
27189
  "### Enabled features",
27150
27190
  `- \`format_on_edit\`: ${formatFlag(status.features.format_on_edit)}`,
@@ -29439,19 +29479,23 @@ ${fileList}`;
29439
29479
  }
29440
29480
  };
29441
29481
  }
29442
- var DELETE_DESCRIPTION = `Delete one or more files with backup.
29482
+ var DELETE_DESCRIPTION = `Delete one or more files (or directories) with backup.
29443
29483
 
29444
- ` + `Each file is backed up before deletion \u2014 use aft_safety undo to recover any of them.
29484
+ ` + "Each file is backed up before deletion \u2014 use aft_safety undo to recover any of them. " + `For directories, every file inside is individually backed up before the tree is removed.
29445
29485
 
29446
- ` + "Returns: { success, complete, deleted: [paths], skipped_files: [{file, reason}] }. Partial success is allowed: files that can be deleted are deleted; files that fail (missing, permission denied, etc.) are reported in skipped_files. `complete: false` indicates at least one file was skipped.";
29486
+ Directory deletion requires recursive: true. Without it, passing a directory returns an error.
29487
+
29488
+ Returns: { success, complete, deleted: [paths], skipped_files: [{file, reason}] }. Partial success is allowed: files that can be deleted are deleted; files that fail (missing, permission denied, etc.) are reported in skipped_files. \`complete: false\` indicates at least one file was skipped.`;
29447
29489
  function createDeleteTool(ctx) {
29448
29490
  return {
29449
29491
  description: DELETE_DESCRIPTION,
29450
29492
  args: {
29451
- files: z4.array(z4.string()).min(1).describe("Paths to delete (one or more). Single-file callers pass a single-element array.")
29493
+ files: z4.array(z4.string()).min(1).describe("Paths to delete (one or more). May include directories when recursive=true."),
29494
+ recursive: z4.boolean().optional().describe("Required to delete a directory and its contents. Defaults to false; passing a directory without this returns an error.")
29452
29495
  },
29453
29496
  execute: async (args, context) => {
29454
29497
  const inputs = args.files;
29498
+ const recursive = args.recursive === true;
29455
29499
  const absolutePaths = inputs.map((f) => path4.isAbsolute(f) ? f : path4.resolve(context.directory, f));
29456
29500
  {
29457
29501
  const asked = new Set;
@@ -29470,19 +29514,13 @@ function createDeleteTool(ctx) {
29470
29514
  always: ["*"],
29471
29515
  metadata: { action: "delete", count: absolutePaths.length }
29472
29516
  }));
29473
- const deleted = [];
29474
- const skipped = [];
29475
- for (const filePath of absolutePaths) {
29476
- const result = await callBridge(ctx, context, "delete_file", { file: filePath });
29477
- if (result.success === false) {
29478
- skipped.push({
29479
- file: filePath,
29480
- reason: result.message || result.code || "delete failed"
29481
- });
29482
- } else {
29483
- deleted.push(filePath);
29484
- }
29485
- }
29517
+ const response = await callBridge(ctx, context, "delete_file", {
29518
+ files: absolutePaths,
29519
+ recursive
29520
+ });
29521
+ const deletedEntries = response.deleted ?? [];
29522
+ const skipped = response.skipped_files ?? [];
29523
+ const deleted = deletedEntries.map((entry) => entry.file);
29486
29524
  if (deleted.length === 0 && skipped.length > 0) {
29487
29525
  throw new Error(`delete failed for all ${skipped.length} file(s):
29488
29526
  ` + skipped.map((entry) => ` ${entry.file}: ${entry.reason}`).join(`
@@ -30108,7 +30146,7 @@ function safetyTools(ctx) {
30108
30146
  ` + `Per-file undo stack is capped at 20 entries (oldest evicted).
30109
30147
 
30110
30148
  ` + `Ops:
30111
- ` + `- 'undo': Undo the last edit to a file. Requires 'filePath'. Note: pops from the undo stack (irreversible, no redo). Use 'history' to inspect before undoing.
30149
+ ` + `- 'undo': Undo the entire last tool call when 'filePath' is omitted (typical), or undo the last edit to one file when 'filePath' is provided. Note: pops from the undo stack (irreversible, no redo). Use 'history' to inspect per-file history before undoing.
30112
30150
  ` + `- 'history': List all edit snapshots for a file. Requires 'filePath'.
30113
30151
  ` + `- 'checkpoint': Save a named snapshot of tracked files. Requires 'name'. Optional 'files' to snapshot specific files only.
30114
30152
  ` + `- 'restore': Restore files to a previously saved checkpoint. Requires 'name'.
@@ -30121,13 +30159,13 @@ function safetyTools(ctx) {
30121
30159
  ` + "Returns: undo { path, backup_id }. history { file, entries }. checkpoint { ok, name }. restore { ok, name }. list { checkpoints }.",
30122
30160
  args: {
30123
30161
  op: z10.enum(["undo", "history", "checkpoint", "restore", "list"]).describe("Safety operation"),
30124
- filePath: z10.string().optional().describe("File path (required for undo, history). Absolute or relative to project root"),
30162
+ filePath: z10.string().optional().describe("File path (required for history, optional for undo). Absolute or relative to project root"),
30125
30163
  name: z10.string().optional().describe("Checkpoint name (required for checkpoint, restore)"),
30126
30164
  files: z10.array(z10.string()).optional().describe("Specific files to include in checkpoint (optional, defaults to all tracked files)")
30127
30165
  },
30128
30166
  execute: async (args, context) => {
30129
30167
  const op = args.op;
30130
- if ((op === "undo" || op === "history") && typeof args.filePath !== "string") {
30168
+ if (op === "history" && typeof args.filePath !== "string") {
30131
30169
  throw new Error(`'filePath' is required for '${op}' op`);
30132
30170
  }
30133
30171
  if ((op === "checkpoint" || op === "restore") && typeof args.name !== "string") {
@@ -30810,24 +30848,22 @@ ${lines}
30810
30848
  pluginVersion: PLUGIN_VERSION
30811
30849
  });
30812
30850
  },
30813
- onBashCompletion: (completion, bridge) => {
30851
+ onBashCompletion: (completion) => {
30814
30852
  const sessionDir = getSessionDirectoryCached(completion.session_id) ?? input.directory;
30815
30853
  handlePushedBgCompletion({
30816
30854
  ctx,
30817
30855
  directory: sessionDir,
30818
30856
  sessionID: completion.session_id,
30819
- client: input.client,
30820
- isActive: () => bridge.hasPendingRequests()
30857
+ client: input.client
30821
30858
  }, completion);
30822
30859
  },
30823
- onBashLongRunning: (reminder, bridge) => {
30860
+ onBashLongRunning: (reminder) => {
30824
30861
  const sessionDir = getSessionDirectoryCached(reminder.session_id) ?? input.directory;
30825
30862
  handlePushedBgLongRunning({
30826
30863
  ctx,
30827
30864
  directory: sessionDir,
30828
30865
  sessionID: reminder.session_id,
30829
- client: input.client,
30830
- isActive: () => bridge.hasPendingRequests()
30866
+ client: input.client
30831
30867
  }, reminder);
30832
30868
  }
30833
30869
  };
@@ -30864,7 +30900,10 @@ ${lines}
30864
30900
  ]);
30865
30901
  }
30866
30902
  const bridge = pool.getBridge(input.directory);
30867
- await bridge.send("status", {}, { configureWarningClient: input.client });
30903
+ const response = await bridge.send("status", {}, { configureWarningClient: input.client });
30904
+ if (response.success !== false) {
30905
+ bridge.cacheStatusSnapshot(response);
30906
+ }
30868
30907
  } catch (err) {
30869
30908
  log2(`eager configure failed: ${err instanceof Error ? err.message : String(err)}`);
30870
30909
  }
@@ -30898,7 +30937,15 @@ ${lines}
30898
30937
  message: "AFT bridge has not been initialized for this project yet. Status will populate after the first tool call."
30899
30938
  };
30900
30939
  }
30901
- return await bridge.send("status", { session_id: sessionID });
30940
+ const cached2 = bridge.getCachedStatus();
30941
+ if (cached2 !== null) {
30942
+ return { success: true, ...cached2 };
30943
+ }
30944
+ const response = await bridge.send("status", { session_id: sessionID });
30945
+ if (response.success !== false) {
30946
+ bridge.cacheStatusSnapshot(response);
30947
+ }
30948
+ return response;
30902
30949
  });
30903
30950
  const storageDir = configOverrides.storage_dir;
30904
30951
  rpcServer.handle("get-announcement", async () => {
@@ -31061,7 +31108,11 @@ Install: ${getManualInstallHint()}`).catch(() => {});
31061
31108
  }
31062
31109
  const sessionDir = await getSessionDirectory(input.client, commandInput.sessionID, input.directory) ?? input.directory;
31063
31110
  const bridge = ctx.pool.getActiveBridgeForRoot(sessionDir) ?? ctx.pool.getBridge(sessionDir);
31064
- const response = await bridge.send("status", { session_id: commandInput.sessionID });
31111
+ const cached2 = bridge.getCachedStatus();
31112
+ const response = cached2 ? { success: true, ...cached2 } : await bridge.send("status", { session_id: commandInput.sessionID });
31113
+ if (!cached2 && response.success !== false) {
31114
+ bridge.cacheStatusSnapshot(response);
31115
+ }
31065
31116
  if (response.success === false) {
31066
31117
  throw new Error(response.message || "status failed");
31067
31118
  }
@@ -1,6 +1,8 @@
1
1
  export interface AftStatusSnapshot {
2
2
  version: string;
3
3
  project_root: string | null;
4
+ canonical_root: string | null;
5
+ cache_role: string;
4
6
  features: {
5
7
  format_on_edit: boolean;
6
8
  validate_on_edit: string;
@@ -47,6 +49,13 @@ export interface AftStatusSnapshot {
47
49
  }
48
50
  export declare function formatBytes(bytes: number): string;
49
51
  export declare function coerceAftStatus(response: Record<string, unknown>): AftStatusSnapshot;
52
+ /**
53
+ * Plain-text status renderer used by the Desktop `sendIgnoredMessage` path,
54
+ * which can only show a plain string. The TUI dialog uses a custom JSX
55
+ * component in `tui/index.tsx` (see `StatusDialog`) so it can render with
56
+ * themed colors, proper flex columns, and right-aligned values instead of
57
+ * monospace padding.
58
+ */
50
59
  export declare function formatStatusDialogMessage(status: AftStatusSnapshot): string;
51
60
  export declare function formatStatusMarkdown(status: AftStatusSnapshot): string;
52
61
  //# sourceMappingURL=status.d.ts.map
@@ -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,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,YAAY,E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;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAwB/E;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA6EnF"}
1
+ {"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuEjD,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,GAAI,IAAI,MAAM,EAAE,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,MAChD,CAAC;AAqRtC;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA+JjE;AAukCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAwB/E;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA6EnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAajD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAoH9E"}
1
+ {"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAajD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAsH9E"}