pi-sdk-web 0.5.13 → 0.5.14

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/server.js +26 -11
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -882,22 +882,37 @@ export class PiWebServer {
882
882
  }
883
883
  };
884
884
  const unsubscribe = this.session.subscribe(listener);
885
- // hasUI by extension: most extensions degrade gracefully to notify()
886
- // (our notify -> browser dialog/toast), but a few (magic-context) use
887
- // ctx.ui.custom() - an extension-drawn TUI panel we can't render. For
888
- // those, hasUI:false routes them to their own text fallback
889
- // (appendEntry -> modal), same as before.
885
+ // hasUI per extension: extensions whose command handler draws a TUI
886
+ // panel via ctx.ui.custom() when hasUI=true need hasUI:false so they
887
+ // use their text fallback instead (pi-web can't render custom()).
888
+ // magic-context /ctx-status -> appendEntry (custom entry -> modal);
889
+ // aft-pi /aft-status (its only command) -> ui.notify(text).
890
+ // Everything else gets hasUI:true so notify-based output works.
890
891
  const cmdPath = (cmd.sourceInfo && cmd.sourceInfo.path) || "";
891
- const customOnly = /pi-magic-context|magic-context/.test(cmdPath);
892
+ const customOnly = /pi-magic-context|magic-context|aft-pi/.test(cmdPath);
893
+ // While a command runs, tag extension notify() broadcasts with the
894
+ // command name as title so the browser renders them as a titled,
895
+ // Markdown modal (e.g. /ctx-status, /aft-status) - the command's status
896
+ // report is a dialog, not a transient stream line. Restores the design
897
+ // in 68b56f1 (recorded in pi-web-design.md §14.9); 41112f5 had dropped
898
+ // the wrapping, so command notifies fell back to persistent status
899
+ // lines while custom-entry commands (/ctx-status) kept the modal.
900
+ const ui = this.uiContext;
901
+ const originalSink = ui.sink;
892
902
  try {
893
- // No sink wrapping: notify() broadcasts go through as-is (no title),
894
- // so the frontend renders them as persistent status lines - the same
895
- // as TUI's notify -> showStatus (a dim line appended to the chat),
896
- // whether or not they come from a command. Command *results* (custom
897
- // entries) still become titled modals via the captured entries below.
903
+ ui.sink = (obj) => {
904
+ const req = obj;
905
+ if (req && req.method === "notify") {
906
+ originalSink({ ...obj, title: `/${name}` });
907
+ }
908
+ else {
909
+ originalSink(obj);
910
+ }
911
+ };
898
912
  await cmd.handler(args, this.buildCommandContext(customOnly ? false : true));
899
913
  }
900
914
  finally {
915
+ ui.sink = originalSink;
901
916
  unsubscribe();
902
917
  }
903
918
  // Show command output as a modal (TUI-like). The session entry remains
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-sdk-web",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "Browser Web access for Pi (AI coding agent) via the Pi SDK - standalone module, zero modification to Pi itself",
5
5
  "type": "module",
6
6
  "bin": {