pi-web-ui 0.34.0 → 0.34.1

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.
@@ -52,7 +52,9 @@ export class PluginManager {
52
52
  this.senders.add(s);
53
53
  return () => this.senders.delete(s);
54
54
  }
55
- /** 客户端上行:路由给对应插件的处理器;未知/未激活的插件静默丢弃。 */
55
+ /** 客户端上行:路由给对应插件的处理器;未知/未激活的插件静默丢弃。
56
+ * 插件代码不可信——同步抛错与返回的 Promise rejection 都必须隔离在
57
+ * 这里,绝不能炸主进程。 */
56
58
  handleMessage(pluginId, payload, from) {
57
59
  if (!ID_RE.test(pluginId))
58
60
  return;
@@ -61,7 +63,12 @@ export class PluginManager {
61
63
  return;
62
64
  for (const h of handlers) {
63
65
  try {
64
- h(payload, from);
66
+ const ret = h(payload, from);
67
+ if (ret instanceof Promise) {
68
+ ret.catch((err) => {
69
+ console.error(`[plugin:${pluginId}] async message handler failed:`, err);
70
+ });
71
+ }
65
72
  }
66
73
  catch (err) {
67
74
  console.error(`[plugin:${pluginId}] message handler failed:`, err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-ui",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
5
5
  "license": "MIT",
6
6
  "type": "module",