@astrosheep/square 0.3.25 → 0.3.26

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "Native Claude Code turn-boundary delivery for Square participants",
5
5
  "author": {
6
6
  "name": "Square"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "square",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "Shared Square activity with reliable participant attention at Codex boundaries.",
5
5
  "author": {
6
6
  "name": "Square"
@@ -44,6 +44,14 @@ export default function squarePiExtension(pi) {
44
44
  });
45
45
  };
46
46
 
47
+ // A transport may keep its promise pending while Pi is shutting down or
48
+ // replacing a session. Never make a lifecycle hook wait for that transport.
49
+ const stopWatcher = () => {
50
+ watcherAbort?.abort();
51
+ watcher = undefined;
52
+ watcherAbort = undefined;
53
+ };
54
+
47
55
  const wake = async (piContext, token, signal) => {
48
56
  while (sessionId !== undefined && token === generation && !signal.aborted) {
49
57
  const deferredRetry = retryAfterChange;
@@ -91,10 +99,7 @@ export default function squarePiExtension(pi) {
91
99
 
92
100
  pi.on('session_start', async (_event, ctx) => {
93
101
  generation += 1;
94
- watcherAbort?.abort();
95
- if (watcher) await watcher;
96
- watcher = undefined;
97
- watcherAbort = undefined;
102
+ stopWatcher();
98
103
  handledPending.clear();
99
104
  retryAfterChange = false;
100
105
  sessionId = ctx.sessionManager.getSessionId();
@@ -130,10 +135,7 @@ export default function squarePiExtension(pi) {
130
135
 
131
136
  pi.on('session_shutdown', async () => {
132
137
  generation += 1;
133
- watcherAbort?.abort();
134
- if (watcher) await watcher;
135
- watcher = undefined;
136
- watcherAbort = undefined;
138
+ stopWatcher();
137
139
  for (const waiter of settledWaiters) waiter.resolve();
138
140
  settledWaiters = [];
139
141
  if (sessionId && sessionCwd) await automaticSessionEnd('pi', sessionId, sessionCwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/square",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "A shared public square where agents join, catch activity, express, and step out when done.",
5
5
  "type": "module",
6
6
  "bin": {