isol8 0.10.2 → 0.10.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/dist/cli.js CHANGED
@@ -56637,7 +56637,7 @@ var package_default;
56637
56637
  var init_package = __esm(() => {
56638
56638
  package_default = {
56639
56639
  name: "isol8",
56640
- version: "0.10.1",
56640
+ version: "0.10.2",
56641
56641
  description: "Secure code execution engine for AI agents",
56642
56642
  author: "Illusion47586",
56643
56643
  license: "MIT",
@@ -58407,11 +58407,12 @@ async function createServer(options) {
58407
58407
  logger.debug(`[Server] Reusing existing session: ${body.sessionId}`);
58408
58408
  engine = session.engine;
58409
58409
  session.lastAccessedAt = Date.now();
58410
+ session.isActive = true;
58410
58411
  } else {
58411
58412
  logger.debug(`[Server] Creating new session: ${body.sessionId}`);
58412
58413
  engine = new DockerIsol82(engineOptions, config.maxConcurrent);
58413
58414
  await engine.start();
58414
- sessions.set(body.sessionId, { engine, lastAccessedAt: Date.now() });
58415
+ sessions.set(body.sessionId, { engine, lastAccessedAt: Date.now(), isActive: true });
58415
58416
  }
58416
58417
  } else {
58417
58418
  logger.debug("[Server] Creating ephemeral engine");
@@ -58433,7 +58434,13 @@ async function createServer(options) {
58433
58434
  logger.debug(`[Server] Execution error: ${message}`);
58434
58435
  return c.json({ error: message }, 500);
58435
58436
  } finally {
58436
- if (!body.sessionId) {
58437
+ if (body.sessionId) {
58438
+ const session = sessions.get(body.sessionId);
58439
+ if (session) {
58440
+ session.isActive = false;
58441
+ session.lastAccessedAt = Date.now();
58442
+ }
58443
+ } else {
58437
58444
  logger.debug("[Server] Cleaning up ephemeral engine");
58438
58445
  await engine.stop();
58439
58446
  }
@@ -58543,6 +58550,9 @@ async function createServer(options) {
58543
58550
  const maxAge = config.cleanup.maxContainerAgeMs;
58544
58551
  const now = Date.now();
58545
58552
  for (const [id, session] of sessions) {
58553
+ if (session.isActive) {
58554
+ continue;
58555
+ }
58546
58556
  if (now - session.lastAccessedAt > maxAge) {
58547
58557
  logger.debug(`[Server] Auto-pruning stale session: ${id}`);
58548
58558
  await session.engine.stop();
@@ -62661,4 +62671,4 @@ if (!process.argv.slice(2).length) {
62661
62671
  }
62662
62672
  program2.parse();
62663
62673
 
62664
- //# debugId=92C54A0066AB3BEC64756E2164756E21
62674
+ //# debugId=FB4CACFD75FE97A064756E2164756E21
package/dist/index.js CHANGED
@@ -1998,7 +1998,7 @@ init_logger();
1998
1998
  // package.json
1999
1999
  var package_default = {
2000
2000
  name: "isol8",
2001
- version: "0.10.1",
2001
+ version: "0.10.2",
2002
2002
  description: "Secure code execution engine for AI agents",
2003
2003
  author: "Illusion47586",
2004
2004
  license: "MIT",
@@ -2172,11 +2172,12 @@ async function createServer(options) {
2172
2172
  logger.debug(`[Server] Reusing existing session: ${body.sessionId}`);
2173
2173
  engine = session.engine;
2174
2174
  session.lastAccessedAt = Date.now();
2175
+ session.isActive = true;
2175
2176
  } else {
2176
2177
  logger.debug(`[Server] Creating new session: ${body.sessionId}`);
2177
2178
  engine = new DockerIsol82(engineOptions, config.maxConcurrent);
2178
2179
  await engine.start();
2179
- sessions.set(body.sessionId, { engine, lastAccessedAt: Date.now() });
2180
+ sessions.set(body.sessionId, { engine, lastAccessedAt: Date.now(), isActive: true });
2180
2181
  }
2181
2182
  } else {
2182
2183
  logger.debug("[Server] Creating ephemeral engine");
@@ -2198,7 +2199,13 @@ async function createServer(options) {
2198
2199
  logger.debug(`[Server] Execution error: ${message}`);
2199
2200
  return c.json({ error: message }, 500);
2200
2201
  } finally {
2201
- if (!body.sessionId) {
2202
+ if (body.sessionId) {
2203
+ const session = sessions.get(body.sessionId);
2204
+ if (session) {
2205
+ session.isActive = false;
2206
+ session.lastAccessedAt = Date.now();
2207
+ }
2208
+ } else {
2202
2209
  logger.debug("[Server] Cleaning up ephemeral engine");
2203
2210
  await engine.stop();
2204
2211
  }
@@ -2308,6 +2315,9 @@ async function createServer(options) {
2308
2315
  const maxAge = config.cleanup.maxContainerAgeMs;
2309
2316
  const now = Date.now();
2310
2317
  for (const [id, session] of sessions) {
2318
+ if (session.isActive) {
2319
+ continue;
2320
+ }
2311
2321
  if (now - session.lastAccessedAt > maxAge) {
2312
2322
  logger.debug(`[Server] Auto-pruning stale session: ${id}`);
2313
2323
  await session.engine.stop();
@@ -2336,4 +2346,4 @@ export {
2336
2346
  BunAdapter
2337
2347
  };
2338
2348
 
2339
- //# debugId=C44D450DD130A4AD64756E2164756E21
2349
+ //# debugId=B5951587CB2FCE7364756E2164756E21
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAWD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa;;;;GAgPxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa;;;;GA2PxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isol8",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Secure code execution engine for AI agents",
5
5
  "author": "Illusion47586",
6
6
  "license": "MIT",