@cortexkit/aft 0.35.3 → 0.35.4

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.
Files changed (2) hide show
  1. package/dist/index.js +77 -62
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -326,6 +326,9 @@ var init_bridge = __esm(() => {
326
326
  hasPendingRequests() {
327
327
  return this.pending.size > 0;
328
328
  }
329
+ getCwd() {
330
+ return this.cwd;
331
+ }
329
332
  getCachedStatus() {
330
333
  return this.cachedStatus;
331
334
  }
@@ -669,6 +672,7 @@ var init_bridge = __esm(() => {
669
672
  const remaining = stdoutDecoder.end();
670
673
  if (remaining)
671
674
  this.onStdoutData(remaining);
675
+ this.flushStdoutBuffer();
672
676
  });
673
677
  const stderrDecoder = new StringDecoder("utf8");
674
678
  child.stderr?.on("data", (chunk) => {
@@ -691,6 +695,7 @@ var init_bridge = __esm(() => {
691
695
  return;
692
696
  if (this._shuttingDown)
693
697
  return;
698
+ this.flushStdoutBuffer();
694
699
  this.logVia(`Process exited: code=${code}, signal=${signal}`);
695
700
  if (signal === "SIGTERM" || signal === "SIGKILL" || signal === "SIGHUP" || signal === "SIGINT") {
696
701
  this.process = null;
@@ -759,71 +764,81 @@ var init_bridge = __esm(() => {
759
764
  this.stdoutBuffer = this.stdoutBuffer.slice(newlineIdx + 1);
760
765
  if (!line)
761
766
  continue;
762
- try {
763
- const response = JSON.parse(line);
764
- this.lastChildActivityAt = Date.now();
765
- if (response.type === "progress") {
766
- const requestId = response.request_id;
767
- const entry = requestId ? this.pending.get(requestId) : undefined;
768
- const kind = response.kind === "stderr" ? "stderr" : "stdout";
769
- const text = typeof response.chunk === "string" ? response.chunk : "";
770
- entry?.onProgress?.({ kind, text });
771
- continue;
772
- }
773
- if (response.type === "permission_ask") {
774
- const requestId = response.request_id;
775
- const entry = requestId ? this.pending.get(requestId) : undefined;
776
- if (requestId && entry) {
777
- this.pending.delete(requestId);
778
- clearTimeout(entry.timer);
779
- entry.resolve({
780
- success: false,
781
- code: "permission_required",
782
- message: "bash command requires permission",
783
- asks: response.asks
784
- });
785
- }
786
- continue;
787
- }
788
- if (response.type === "bash_completed") {
789
- this.onBashCompletion?.(response, this);
790
- continue;
791
- }
792
- if (response.type === "bash_long_running") {
793
- this.onBashLongRunning?.(response, this);
794
- continue;
795
- }
796
- if (response.type === "bash_pattern_match") {
797
- this.onBashPatternMatch?.(response, this);
798
- continue;
799
- }
800
- if (response.type === "configure_warnings") {
801
- this.handleConfigureWarningsFrame(response).catch((err) => {
802
- this.warnVia(`configure warning delivery failed: ${err instanceof Error ? err.message : String(err)}`);
767
+ this.processStdoutLine(line);
768
+ }
769
+ }
770
+ flushStdoutBuffer() {
771
+ const line = this.stdoutBuffer.trim();
772
+ this.stdoutBuffer = "";
773
+ if (!line)
774
+ return;
775
+ this.processStdoutLine(line);
776
+ }
777
+ processStdoutLine(line) {
778
+ try {
779
+ const response = JSON.parse(line);
780
+ this.lastChildActivityAt = Date.now();
781
+ if (response.type === "progress") {
782
+ const requestId = response.request_id;
783
+ const entry = requestId ? this.pending.get(requestId) : undefined;
784
+ const kind = response.kind === "stderr" ? "stderr" : "stdout";
785
+ const text = typeof response.chunk === "string" ? response.chunk : "";
786
+ entry?.onProgress?.({ kind, text });
787
+ return;
788
+ }
789
+ if (response.type === "permission_ask") {
790
+ const requestId = response.request_id;
791
+ const entry = requestId ? this.pending.get(requestId) : undefined;
792
+ if (requestId && entry) {
793
+ this.pending.delete(requestId);
794
+ clearTimeout(entry.timer);
795
+ entry.resolve({
796
+ success: false,
797
+ code: "permission_required",
798
+ message: "bash command requires permission",
799
+ asks: response.asks
803
800
  });
804
- continue;
805
- }
806
- if (response.type === "status_changed") {
807
- this.handleStatusChangedFrame(response);
808
- continue;
809
801
  }
810
- const id = response.id;
811
- if (id && this.pending.has(id)) {
812
- const entry = this.pending.get(id);
813
- if (!entry)
814
- continue;
815
- this.pending.delete(id);
816
- clearTimeout(entry.timer);
817
- this.consecutiveRequestTimeouts = 0;
818
- this.scheduleRestartCountReset();
819
- this.captureStatusBar(response);
820
- entry.resolve(response);
821
- } else if (typeof response.type === "string") {
822
- this.logVia(`Ignoring unknown stdout push frame type: ${response.type}`);
823
- }
824
- } catch (_err) {
825
- this.warnVia(`Failed to parse stdout line: ${line}`);
802
+ return;
803
+ }
804
+ if (response.type === "bash_completed") {
805
+ this.onBashCompletion?.(response, this);
806
+ return;
807
+ }
808
+ if (response.type === "bash_long_running") {
809
+ this.onBashLongRunning?.(response, this);
810
+ return;
811
+ }
812
+ if (response.type === "bash_pattern_match") {
813
+ this.onBashPatternMatch?.(response, this);
814
+ return;
815
+ }
816
+ if (response.type === "configure_warnings") {
817
+ this.handleConfigureWarningsFrame(response).catch((err) => {
818
+ this.warnVia(`configure warning delivery failed: ${err instanceof Error ? err.message : String(err)}`);
819
+ });
820
+ return;
821
+ }
822
+ if (response.type === "status_changed") {
823
+ this.handleStatusChangedFrame(response);
824
+ return;
825
+ }
826
+ const id = response.id;
827
+ if (id && this.pending.has(id)) {
828
+ const entry = this.pending.get(id);
829
+ if (!entry)
830
+ return;
831
+ this.pending.delete(id);
832
+ clearTimeout(entry.timer);
833
+ this.consecutiveRequestTimeouts = 0;
834
+ this.scheduleRestartCountReset();
835
+ this.captureStatusBar(response);
836
+ entry.resolve(response);
837
+ } else if (typeof response.type === "string") {
838
+ this.logVia(`Ignoring unknown stdout push frame type: ${response.type}`);
826
839
  }
840
+ } catch (_err) {
841
+ this.warnVia(`Failed to parse stdout line: ${line}`);
827
842
  }
828
843
  }
829
844
  captureStatusBar(response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.35.3",
3
+ "version": "0.35.4",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@clack/prompts": "^1.2.0",
27
- "@cortexkit/aft-bridge": "0.35.3",
27
+ "@cortexkit/aft-bridge": "0.35.4",
28
28
  "comment-json": "^4.6.2"
29
29
  },
30
30
  "devDependencies": {