@nextclaw/ncp-toolkit 0.5.14 → 0.5.15

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/dist/index.d.ts CHANGED
@@ -176,6 +176,7 @@ declare class DefaultNcpAgentBackend implements NcpAgentServerEndpoint, NcpSessi
176
176
  signal: AbortSignal;
177
177
  }, opts?: NcpAgentRunStreamOptions) => AsyncIterable<NcpEndpointEvent>;
178
178
  listSessions: () => Promise<NcpSessionSummary[]>;
179
+ isLiveSessionRunning: (sessionId: string) => boolean;
179
180
  listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
180
181
  getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
181
182
  appendMessage: (sessionId: string, message: NcpMessage) => Promise<NcpSessionSummary | null>;
package/dist/index.js CHANGED
@@ -1260,6 +1260,9 @@ const DEFAULT_SUPPORTED_PART_TYPES = [
1260
1260
  "action",
1261
1261
  "extension"
1262
1262
  ];
1263
+ const disposeRuntime = async (runtime) => {
1264
+ await runtime.dispose?.();
1265
+ };
1263
1266
  var DefaultNcpAgentBackend = class {
1264
1267
  manifest;
1265
1268
  sessionStore;
@@ -1321,12 +1324,14 @@ var DefaultNcpAgentBackend = class {
1321
1324
  const execution = session.activeExecution;
1322
1325
  if (!execution) {
1323
1326
  session.publisher.close();
1327
+ await disposeRuntime(session.runtime);
1324
1328
  continue;
1325
1329
  }
1326
1330
  execution.abortHandled = true;
1327
1331
  execution.controller.abort();
1328
1332
  this.finishSessionExecution(session, execution);
1329
1333
  session.publisher.close();
1334
+ await disposeRuntime(session.runtime);
1330
1335
  }
1331
1336
  this.sessionRegistry.clear();
1332
1337
  };
@@ -1401,6 +1406,7 @@ var DefaultNcpAgentBackend = class {
1401
1406
  liveSessions: this.sessionRegistry.listSessions()
1402
1407
  });
1403
1408
  };
1409
+ isLiveSessionRunning = (sessionId) => Boolean(this.sessionRegistry.getSession(sessionId)?.activeExecution);
1404
1410
  listSessionMessages = async (sessionId) => {
1405
1411
  return listBackendSessionMessages({
1406
1412
  sessionStore: this.sessionStore,
@@ -1446,6 +1452,7 @@ var DefaultNcpAgentBackend = class {
1446
1452
  execution.closed = true;
1447
1453
  }
1448
1454
  liveSession?.publisher.close();
1455
+ if (liveSession) await disposeRuntime(liveSession.runtime);
1449
1456
  await this.sessionStore.deleteSession(sessionId);
1450
1457
  };
1451
1458
  ensureStarted = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/ncp-toolkit",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "private": false,
5
5
  "description": "Toolkit implementations built on top of the NextClaw Communication Protocol.",
6
6
  "type": "module",
@@ -15,14 +15,14 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@nextclaw/ncp": "0.5.9"
18
+ "@nextclaw/ncp": "0.5.10"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.17.6",
22
22
  "prettier": "^3.3.3",
23
23
  "typescript": "^5.6.3",
24
24
  "vitest": "^4.1.2",
25
- "@nextclaw/ncp-agent-runtime": "0.3.19"
25
+ "@nextclaw/ncp-agent-runtime": "0.3.20"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsdown src/index.ts --dts --clean --target es2022 --no-fixedExtension",