@f5-sales-demo/xcsh 22.14.2 → 22.14.3

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/xcsh",
4
- "version": "22.14.2",
4
+ "version": "22.14.3",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/f5-sales-demo/xcsh",
7
7
  "author": "Can Boluk",
@@ -68,13 +68,13 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@agentclientprotocol/sdk": "1.4.0",
71
- "@f5-sales-demo/pi-agent-core": "22.14.2",
72
- "@f5-sales-demo/pi-ai": "22.14.2",
73
- "@f5-sales-demo/pi-natives": "22.14.2",
74
- "@f5-sales-demo/pi-resource-management": "22.14.2",
75
- "@f5-sales-demo/pi-tui": "22.14.2",
76
- "@f5-sales-demo/pi-utils": "22.14.2",
77
- "@f5-sales-demo/xcsh-stats": "22.14.2",
71
+ "@f5-sales-demo/pi-agent-core": "22.14.3",
72
+ "@f5-sales-demo/pi-ai": "22.14.3",
73
+ "@f5-sales-demo/pi-natives": "22.14.3",
74
+ "@f5-sales-demo/pi-resource-management": "22.14.3",
75
+ "@f5-sales-demo/pi-tui": "22.14.3",
76
+ "@f5-sales-demo/pi-utils": "22.14.3",
77
+ "@f5-sales-demo/xcsh-stats": "22.14.3",
78
78
  "@mozilla/readability": "^0.6",
79
79
  "@resvg/resvg-wasm": "2.6.2",
80
80
  "@sinclair/typebox": "0.34.52",
@@ -146,12 +146,44 @@ export class ChatHandler {
146
146
  }
147
147
  if (isInteractionCommand(msg) && (msg.type === "interaction_respond" || msg.type === "interaction_cancel")) {
148
148
  if (msg.type === "interaction_respond") {
149
+ const pending = this.#session.userInteractions.pending().find(request => request.id === msg.requestId);
150
+ const chatId =
151
+ typeof Reflect.get(msg, "chatId") === "string" ? (Reflect.get(msg, "chatId") as string) : undefined;
152
+ let resumed: ActiveChat | undefined;
153
+ if (pending?.delivery === "async" && !this.busy && chatId && /^[A-Za-z0-9:_-]{1,128}$/.test(chatId)) {
154
+ resumed = {
155
+ id: chatId,
156
+ items: new Map(),
157
+ nextItem: 0,
158
+ terminalSent: false,
159
+ unsubscribe: () => {},
160
+ entryAt: Date.now(),
161
+ promptAt: Date.now(),
162
+ spanEmitted: false,
163
+ lastKeepaliveAt: 0,
164
+ };
165
+ const chat = resumed;
166
+ this.#activeChats.set(chat.id, chat);
167
+ chat.unsubscribe = this.#session.subscribe(event => {
168
+ this.#handleSessionEvent(chat, event);
169
+ if (event.type === "agent_end") {
170
+ if (!chat.terminalSent) this.#sendTerminal(chat, { type: "chat_done", id: chat.id });
171
+ chat.unsubscribe();
172
+ this.#activeChats.delete(chat.id);
173
+ }
174
+ });
175
+ }
149
176
  const accepted = this.#session.userInteractions.respondExternal(
150
177
  msg.requestId,
151
178
  msg.responseId,
152
179
  msg.value,
153
180
  msg.identity,
154
181
  );
182
+
183
+ if (!accepted && resumed) {
184
+ resumed.unsubscribe();
185
+ this.#activeChats.delete(resumed.id);
186
+ }
155
187
  this.#server.send({ type: "interaction_receipt", responseId: msg.responseId, accepted });
156
188
  } else {
157
189
  const request = this.#session.userInteractions.pending().find(request => request.id === msg.requestId);