isol8 0.10.2-alpha.0 → 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
@@ -6318,7 +6318,7 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
6318
6318
 
6319
6319
  // node_modules/cpu-features/build/Release/cpufeatures.node
6320
6320
  var require_cpufeatures = __commonJS((exports, module) => {
6321
- module.exports = __require("./cpufeatures-8g73ch7n.node");
6321
+ module.exports = __require("./cpufeatures-tjjrgpt7.node");
6322
6322
  });
6323
6323
 
6324
6324
  // node_modules/cpu-features/lib/index.js
@@ -6931,12 +6931,12 @@ var require_utils2 = __commonJS((exports, module) => {
6931
6931
 
6932
6932
  // node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
6933
6933
  var require_sshcrypto = __commonJS((exports, module) => {
6934
- module.exports = __require("./sshcrypto-f6atjna1.node");
6934
+ module.exports = __require("./sshcrypto-0209sx47.node");
6935
6935
  });
6936
6936
 
6937
6937
  // node_modules/ssh2/lib/protocol/crypto/poly1305.js
6938
6938
  var require_poly1305 = __commonJS((exports, module) => {
6939
- var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib/protocol/crypto", __filename = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
6939
+ var __dirname = "/home/runner/work/isol8/isol8/node_modules/ssh2/lib/protocol/crypto", __filename = "/home/runner/work/isol8/isol8/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
6940
6940
  var createPoly1305 = function() {
6941
6941
  var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
6942
6942
  if (typeof __filename !== "undefined")
@@ -8681,7 +8681,7 @@ ${formatted}-----END ${type} KEY-----`;
8681
8681
  }
8682
8682
  return Buffer.from(hex, "hex");
8683
8683
  }
8684
- return function genOpenSSLRSAPriv(n, e, d, iqmp, p, q) {
8684
+ return function genOpenSSLRSAPriv2(n, e, d, iqmp, p, q) {
8685
8685
  const bn_d = bigIntFromBuffer(d);
8686
8686
  const dmp1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(p) - 1n));
8687
8687
  const dmq1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(q) - 1n));
@@ -9709,7 +9709,7 @@ ${formatted}-----END ${type} KEY-----`;
9709
9709
 
9710
9710
  // node_modules/ssh2/lib/agent.js
9711
9711
  var require_agent = __commonJS((exports, module) => {
9712
- var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib";
9712
+ var __dirname = "/home/runner/work/isol8/isol8/node_modules/ssh2/lib";
9713
9713
  var { Socket } = __require("net");
9714
9714
  var { Duplex } = __require("stream");
9715
9715
  var { resolve } = __require("path");
@@ -21682,7 +21682,7 @@ var require__stream_writable = __commonJS((exports, module) => {
21682
21682
  }
21683
21683
  });
21684
21684
  } else {
21685
- realHasInstance = function realHasInstance(object) {
21685
+ realHasInstance = function realHasInstance2(object) {
21686
21686
  return object instanceof this;
21687
21687
  };
21688
21688
  }
@@ -22480,28 +22480,28 @@ var require_end_of_stream = __commonJS((exports, module) => {
22480
22480
  callback = once(callback || noop);
22481
22481
  var readable = opts.readable || opts.readable !== false && stream.readable;
22482
22482
  var writable = opts.writable || opts.writable !== false && stream.writable;
22483
- var onlegacyfinish = function onlegacyfinish() {
22483
+ var onlegacyfinish = function onlegacyfinish2() {
22484
22484
  if (!stream.writable)
22485
22485
  onfinish();
22486
22486
  };
22487
22487
  var writableEnded = stream._writableState && stream._writableState.finished;
22488
- var onfinish = function onfinish() {
22488
+ var onfinish = function onfinish2() {
22489
22489
  writable = false;
22490
22490
  writableEnded = true;
22491
22491
  if (!readable)
22492
22492
  callback.call(stream);
22493
22493
  };
22494
22494
  var readableEnded = stream._readableState && stream._readableState.endEmitted;
22495
- var onend = function onend() {
22495
+ var onend = function onend2() {
22496
22496
  readable = false;
22497
22497
  readableEnded = true;
22498
22498
  if (!writable)
22499
22499
  callback.call(stream);
22500
22500
  };
22501
- var onerror = function onerror(err) {
22501
+ var onerror = function onerror2(err) {
22502
22502
  callback.call(stream, err);
22503
22503
  };
22504
- var onclose = function onclose() {
22504
+ var onclose = function onclose2() {
22505
22505
  var err;
22506
22506
  if (readable && !readableEnded) {
22507
22507
  if (!stream._readableState || !stream._readableState.ended)
@@ -22514,7 +22514,7 @@ var require_end_of_stream = __commonJS((exports, module) => {
22514
22514
  return callback.call(stream, err);
22515
22515
  }
22516
22516
  };
22517
- var onrequest = function onrequest() {
22517
+ var onrequest = function onrequest2() {
22518
22518
  stream.req.on("finish", onfinish);
22519
22519
  };
22520
22520
  if (isRequest(stream)) {
@@ -22671,7 +22671,7 @@ var require_async_iterator = __commonJS((exports, module) => {
22671
22671
  });
22672
22672
  });
22673
22673
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
22674
- var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
22674
+ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {
22675
22675
  var _Object$create;
22676
22676
  var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
22677
22677
  value: stream,
@@ -22860,7 +22860,7 @@ var require__stream_readable = __commonJS((exports, module) => {
22860
22860
  var Duplex;
22861
22861
  Readable.ReadableState = ReadableState;
22862
22862
  var EE = __require("events").EventEmitter;
22863
- var EElistenerCount = function EElistenerCount(emitter, type) {
22863
+ var EElistenerCount = function EElistenerCount2(emitter, type) {
22864
22864
  return emitter.listeners(type).length;
22865
22865
  };
22866
22866
  var Stream = __require("stream");
@@ -22877,7 +22877,7 @@ var require__stream_readable = __commonJS((exports, module) => {
22877
22877
  if (debugUtil && debugUtil.debuglog) {
22878
22878
  debug = debugUtil.debuglog("stream");
22879
22879
  } else {
22880
- debug = function debug() {};
22880
+ debug = function debug2() {};
22881
22881
  }
22882
22882
  var BufferList = require_buffer_list();
22883
22883
  var destroyImpl = require_destroy();
@@ -25535,14 +25535,14 @@ var require_BufferList = __commonJS((exports, module) => {
25535
25535
  if (srcEnd <= 0) {
25536
25536
  return dst || Buffer2.alloc(0);
25537
25537
  }
25538
- const copy = !!dst;
25538
+ const copy2 = !!dst;
25539
25539
  const off = this._offset(srcStart);
25540
25540
  const len = srcEnd - srcStart;
25541
25541
  let bytes = len;
25542
- let bufoff = copy && dstStart || 0;
25542
+ let bufoff = copy2 && dstStart || 0;
25543
25543
  let start = off[1];
25544
25544
  if (srcStart === 0 && srcEnd === this.length) {
25545
- if (!copy) {
25545
+ if (!copy2) {
25546
25546
  return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
25547
25547
  }
25548
25548
  for (let i = 0;i < this._bufs.length; i++) {
@@ -25552,9 +25552,9 @@ var require_BufferList = __commonJS((exports, module) => {
25552
25552
  return dst;
25553
25553
  }
25554
25554
  if (bytes <= this._bufs[off[0]].length - start) {
25555
- return copy ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
25555
+ return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
25556
25556
  }
25557
- if (!copy) {
25557
+ if (!copy2) {
25558
25558
  dst = Buffer2.allocUnsafe(len);
25559
25559
  }
25560
25560
  for (let i = off[0];i < this._bufs.length; i++) {
@@ -25776,7 +25776,7 @@ var require_bl = __commonJS((exports, module) => {
25776
25776
  }
25777
25777
  if (typeof callback === "function") {
25778
25778
  this._callback = callback;
25779
- const piper = function piper(err) {
25779
+ const piper = function piper2(err) {
25780
25780
  if (this._callback) {
25781
25781
  this._callback(err);
25782
25782
  this._callback = null;
@@ -34839,7 +34839,7 @@ var require_writer2 = __commonJS((exports, module) => {
34839
34839
  this.tail = this.head;
34840
34840
  this.states = null;
34841
34841
  }
34842
- var create = function create() {
34842
+ var create = function create2() {
34843
34843
  return util.Buffer ? function create_buffer_setup() {
34844
34844
  return (Writer.create = function create_buffer() {
34845
34845
  return new BufferWriter;
@@ -35063,12 +35063,12 @@ var require_reader2 = __commonJS((exports, module) => {
35063
35063
  if (buffer instanceof Uint8Array || Array.isArray(buffer))
35064
35064
  return new Reader(buffer);
35065
35065
  throw Error("illegal buffer");
35066
- } : function create_array(buffer) {
35066
+ } : function create_array2(buffer) {
35067
35067
  if (Array.isArray(buffer))
35068
35068
  return new Reader(buffer);
35069
35069
  throw Error("illegal buffer");
35070
35070
  };
35071
- var create = function create() {
35071
+ var create = function create2() {
35072
35072
  return util.Buffer ? function create_buffer_setup(buffer) {
35073
35073
  return (Reader.create = function create_buffer(buffer2) {
35074
35074
  return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
@@ -35494,10 +35494,10 @@ var require_fetch = __commonJS((exports, module) => {
35494
35494
  // node_modules/@protobufjs/path/index.js
35495
35495
  var require_path = __commonJS((exports) => {
35496
35496
  var path = exports;
35497
- var isAbsolute = path.isAbsolute = function isAbsolute(path2) {
35497
+ var isAbsolute = path.isAbsolute = function isAbsolute2(path2) {
35498
35498
  return /^(?:\/|\w+:)/.test(path2);
35499
35499
  };
35500
- var normalize = path.normalize = function normalize(path2) {
35500
+ var normalize = path.normalize = function normalize2(path2) {
35501
35501
  path2 = path2.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
35502
35502
  var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = "";
35503
35503
  if (absolute)
@@ -35662,7 +35662,7 @@ var require_namespace = __commonJS((exports, module) => {
35662
35662
  object.onRemove(this);
35663
35663
  return clearCache(this);
35664
35664
  };
35665
- Namespace.prototype.define = function define(path, json) {
35665
+ Namespace.prototype.define = function define2(path, json) {
35666
35666
  if (util.isString(path))
35667
35667
  path = path.split(".");
35668
35668
  else if (!Array.isArray(path))
@@ -42478,7 +42478,7 @@ var require_src3 = __commonJS((exports) => {
42478
42478
 
42479
42479
  // node_modules/@grpc/grpc-js/build/src/channelz.js
42480
42480
  var require_channelz = __commonJS((exports) => {
42481
- var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/@grpc/grpc-js/build/src";
42481
+ var __dirname = "/home/runner/work/isol8/isol8/node_modules/@grpc/grpc-js/build/src";
42482
42482
  Object.defineProperty(exports, "__esModule", { value: true });
42483
42483
  exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = undefined;
42484
42484
  exports.unregisterChannelzRef = unregisterChannelzRef;
@@ -47881,7 +47881,7 @@ var require_duration = __commonJS((exports) => {
47881
47881
 
47882
47882
  // node_modules/@grpc/grpc-js/build/src/orca.js
47883
47883
  var require_orca = __commonJS((exports) => {
47884
- var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/@grpc/grpc-js/build/src";
47884
+ var __dirname = "/home/runner/work/isol8/isol8/node_modules/@grpc/grpc-js/build/src";
47885
47885
  Object.defineProperty(exports, "__esModule", { value: true });
47886
47886
  exports.OrcaOobMetricsSubchannelWrapper = exports.GRPC_METRICS_HEADER = exports.ServerMetricRecorder = exports.PerRequestMetricRecorder = undefined;
47887
47887
  exports.createOrcaClient = createOrcaClient;
@@ -53270,7 +53270,7 @@ var require_dist = __commonJS((exports) => {
53270
53270
 
53271
53271
  // node_modules/dockerode/lib/session.js
53272
53272
  var require_session = __commonJS((exports, module) => {
53273
- var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/dockerode/lib";
53273
+ var __dirname = "/home/runner/work/isol8/isol8/node_modules/dockerode/lib";
53274
53274
  var grpc = require_src4();
53275
53275
  var protoLoader = require_src5();
53276
53276
  var path = __require("path");
@@ -54496,7 +54496,7 @@ var require_docker = __commonJS((exports, module) => {
54496
54496
  stream: true,
54497
54497
  stdout: true,
54498
54498
  stderr: true
54499
- }, function handler(err2, stream) {
54499
+ }, function handler2(err2, stream) {
54500
54500
  if (err2)
54501
54501
  return callback(err2, null, container);
54502
54502
  hub.emit("stream", stream);
@@ -56624,11 +56624,11 @@ class DockerIsol8 {
56624
56624
  }
56625
56625
  var import_dockerode, SANDBOX_WORKDIR = "/sandbox", MAX_OUTPUT_BYTES, PROXY_PORT = 8118, PROXY_STARTUP_TIMEOUT_MS = 5000, PROXY_POLL_INTERVAL_MS = 100;
56626
56626
  var init_docker = __esm(() => {
56627
- import_dockerode = __toESM(require_docker(), 1);
56628
56627
  init_runtime();
56629
56628
  init_logger();
56630
56629
  init_audit();
56631
56630
  init_pool();
56631
+ import_dockerode = __toESM(require_docker(), 1);
56632
56632
  MAX_OUTPUT_BYTES = 1024 * 1024;
56633
56633
  });
56634
56634
 
@@ -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.2-alpha.0",
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();
@@ -59174,7 +59184,7 @@ onetime.callCount = (function_) => {
59174
59184
  };
59175
59185
  var onetime_default = onetime;
59176
59186
 
59177
- // node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
59187
+ // node_modules/signal-exit/dist/mjs/signals.js
59178
59188
  var signals = [];
59179
59189
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
59180
59190
  if (process.platform !== "win32") {
@@ -59184,7 +59194,7 @@ if (process.platform === "linux") {
59184
59194
  signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
59185
59195
  }
59186
59196
 
59187
- // node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
59197
+ // node_modules/signal-exit/dist/mjs/index.js
59188
59198
  var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
59189
59199
  var kExitEmitter = Symbol.for("signal-exit emitter");
59190
59200
  var global2 = globalThis;
@@ -62661,4 +62671,4 @@ if (!process.argv.slice(2).length) {
62661
62671
  }
62662
62672
  program2.parse();
62663
62673
 
62664
- //# debugId=AB0B8F37F6C568CA64756E2164756E21
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.2-alpha.0",
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=254BC488982F064964756E2164756E21
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-alpha.0",
3
+ "version": "0.10.3",
4
4
  "description": "Secure code execution engine for AI agents",
5
5
  "author": "Illusion47586",
6
6
  "license": "MIT",