agent-web-os 0.3.0-beta.0 → 0.3.1

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.
@@ -0,0 +1,98 @@
1
+ import {
2
+ DEMO_PACKAGES,
3
+ DevServer,
4
+ NextDevServer,
5
+ PACKAGE_JSON,
6
+ PackageManager,
7
+ Runtime,
8
+ SANDBOX_SETUP_INSTRUCTIONS,
9
+ SandboxRuntime,
10
+ ServerBridge,
11
+ VirtualFS,
12
+ ViteDevServer,
13
+ WorkerRuntime,
14
+ assert$1,
15
+ chokidarShim,
16
+ createContainer,
17
+ createConvexAppProject,
18
+ createFsShim,
19
+ createProcess,
20
+ createRuntime,
21
+ esbuildShim,
22
+ events$1,
23
+ execute,
24
+ fseventsShim,
25
+ generateSandboxFiles,
26
+ getSandboxHtml,
27
+ getSandboxVercelConfig,
28
+ getServerBridge,
29
+ httpShim,
30
+ index,
31
+ initConvexAppDemo,
32
+ install,
33
+ moduleShim,
34
+ netShim,
35
+ pathShim,
36
+ perfHooksShim,
37
+ querystringShim,
38
+ readdirpShim,
39
+ resetServerBridge,
40
+ rollupShim,
41
+ startConvexAppDevServer,
42
+ stream,
43
+ urlShim,
44
+ utilShim,
45
+ workerThreadsShim,
46
+ wsShim
47
+ } from "./chunk-YMOX2CWB.js";
48
+ import "./chunk-JTZ3QUCT.js";
49
+ import "./chunk-PR4QN5HX.js";
50
+ export {
51
+ DEMO_PACKAGES as CONVEX_APP_DEMO_PACKAGES,
52
+ PACKAGE_JSON as CONVEX_APP_PACKAGE_JSON,
53
+ DevServer,
54
+ NextDevServer,
55
+ PackageManager,
56
+ Runtime,
57
+ SANDBOX_SETUP_INSTRUCTIONS,
58
+ SandboxRuntime,
59
+ ServerBridge,
60
+ VirtualFS,
61
+ ViteDevServer,
62
+ WorkerRuntime,
63
+ assert$1 as assert,
64
+ chokidarShim as chokidar,
65
+ createContainer,
66
+ createConvexAppProject,
67
+ createFsShim,
68
+ createProcess,
69
+ createRuntime,
70
+ createContainer as default,
71
+ esbuildShim as esbuild,
72
+ events$1 as events,
73
+ execute,
74
+ fseventsShim as fsevents,
75
+ generateSandboxFiles,
76
+ getSandboxHtml,
77
+ getSandboxVercelConfig,
78
+ getServerBridge,
79
+ httpShim as http,
80
+ initConvexAppDemo,
81
+ install,
82
+ moduleShim as module,
83
+ netShim as net,
84
+ index as npm,
85
+ pathShim as path,
86
+ perfHooksShim as perf_hooks,
87
+ querystringShim as querystring,
88
+ readdirpShim as readdirp,
89
+ resetServerBridge,
90
+ rollupShim as rollup,
91
+ startConvexAppDevServer,
92
+ stream,
93
+ urlShim as url,
94
+ utilShim as util,
95
+ workerThreadsShim as worker_threads,
96
+ wsShim as ws
97
+ };
98
+ //# sourceMappingURL=dist-2XQJWZPX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.cjs CHANGED
@@ -41176,6 +41176,55 @@ var init_index_web = __esm({
41176
41176
  });
41177
41177
 
41178
41178
  // node_modules/almostnode/dist/index.mjs
41179
+ var dist_exports = {};
41180
+ __export(dist_exports, {
41181
+ CONVEX_APP_DEMO_PACKAGES: () => DEMO_PACKAGES,
41182
+ CONVEX_APP_PACKAGE_JSON: () => PACKAGE_JSON,
41183
+ DevServer: () => DevServer,
41184
+ NextDevServer: () => NextDevServer,
41185
+ PackageManager: () => PackageManager,
41186
+ Runtime: () => Runtime,
41187
+ SANDBOX_SETUP_INSTRUCTIONS: () => SANDBOX_SETUP_INSTRUCTIONS,
41188
+ SandboxRuntime: () => SandboxRuntime,
41189
+ ServerBridge: () => ServerBridge,
41190
+ VirtualFS: () => VirtualFS,
41191
+ ViteDevServer: () => ViteDevServer,
41192
+ WorkerRuntime: () => WorkerRuntime,
41193
+ assert: () => assert$1,
41194
+ chokidar: () => chokidarShim,
41195
+ createContainer: () => createContainer,
41196
+ createConvexAppProject: () => createConvexAppProject,
41197
+ createFsShim: () => createFsShim,
41198
+ createProcess: () => createProcess,
41199
+ createRuntime: () => createRuntime,
41200
+ default: () => createContainer,
41201
+ esbuild: () => esbuildShim,
41202
+ events: () => events$1,
41203
+ execute: () => execute,
41204
+ fsevents: () => fseventsShim,
41205
+ generateSandboxFiles: () => generateSandboxFiles,
41206
+ getSandboxHtml: () => getSandboxHtml,
41207
+ getSandboxVercelConfig: () => getSandboxVercelConfig,
41208
+ getServerBridge: () => getServerBridge,
41209
+ http: () => httpShim,
41210
+ initConvexAppDemo: () => initConvexAppDemo,
41211
+ install: () => install,
41212
+ module: () => moduleShim,
41213
+ net: () => netShim,
41214
+ npm: () => index,
41215
+ path: () => pathShim,
41216
+ perf_hooks: () => perfHooksShim,
41217
+ querystring: () => querystringShim,
41218
+ readdirp: () => readdirpShim,
41219
+ resetServerBridge: () => resetServerBridge,
41220
+ rollup: () => rollupShim,
41221
+ startConvexAppDevServer: () => startConvexAppDevServer,
41222
+ stream: () => stream,
41223
+ url: () => urlShim,
41224
+ util: () => utilShim,
41225
+ worker_threads: () => workerThreadsShim,
41226
+ ws: () => wsShim
41227
+ });
41179
41228
  function uint8ToBase64(bytes) {
41180
41229
  const parts = [];
41181
41230
  for (let i22 = 0; i22 < bytes.length; i22 += CHUNK) {
@@ -75249,11 +75298,35 @@ console.error(${JSON.stringify(message)});`;
75249
75298
  }
75250
75299
  });
75251
75300
 
75301
+ // src/server-bridge.ts
75302
+ function loadAlmostnode() {
75303
+ if (!almostnodePromise) {
75304
+ almostnodePromise = Promise.resolve().then(() => (init_dist2(), dist_exports));
75305
+ }
75306
+ return almostnodePromise;
75307
+ }
75308
+ async function getServerBridge2() {
75309
+ if (!globalBridge2) {
75310
+ const mod = await loadAlmostnode();
75311
+ globalBridge2 = mod.getServerBridge();
75312
+ }
75313
+ return globalBridge2;
75314
+ }
75315
+ function resetServerBridge2() {
75316
+ globalBridge2 = null;
75317
+ }
75318
+ var globalBridge2, almostnodePromise;
75319
+ var init_server_bridge = __esm({
75320
+ "src/server-bridge.ts"() {
75321
+ globalBridge2 = null;
75322
+ almostnodePromise = null;
75323
+ }
75324
+ });
75325
+
75252
75326
  // src/almostnode-session.ts
75253
75327
  var almostnode_session_exports = {};
75254
75328
  __export(almostnode_session_exports, {
75255
- AlmostNodeSession: () => AlmostNodeSession,
75256
- createAlmostNodeSession: () => createAlmostNodeSession
75329
+ AlmostNodeSession: () => AlmostNodeSession
75257
75330
  });
75258
75331
  function stripDotSlash(p) {
75259
75332
  return p.startsWith("./") ? p.slice(2) : p;
@@ -75450,14 +75523,12 @@ function removeVirtualPath(vfs2, targetPath) {
75450
75523
  }
75451
75524
  vfs2.rmdirSync(normalizedPath);
75452
75525
  }
75453
- function createAlmostNodeSession(fs2) {
75454
- return new AlmostNodeSession(fs2);
75455
- }
75456
75526
  var ALMOSTNODE_INTERNAL_ROOT, ALMOSTNODE_NODE_VERSION, ALMOSTNODE_NPM_VERSION, NODE_EXEC_PATH, GLOBAL_NODE_MODULES_ROOT, DEFAULT_PATH, NPM_USAGE, STATIC_MIME_TYPES, ESBUILD_WASM_VERSION2, AlmostNodeVirtualFs, AlmostNodeSession;
75457
75527
  var init_almostnode_session = __esm({
75458
75528
  "src/almostnode-session.ts"() {
75459
75529
  init_posix_path();
75460
75530
  init_dist2();
75531
+ init_server_bridge();
75461
75532
  ALMOSTNODE_INTERNAL_ROOT = "/.almostnode";
75462
75533
  ALMOSTNODE_NODE_VERSION = "v20.0.0";
75463
75534
  ALMOSTNODE_NPM_VERSION = "9.6.4";
@@ -75695,6 +75766,7 @@ var init_almostnode_session = __esm({
75695
75766
  vitePort = null;
75696
75767
  vitePreviewUrl = null;
75697
75768
  vitePreviewListener;
75769
+ serverBridge;
75698
75770
  parsedPackageJsonCache = /* @__PURE__ */ new Map();
75699
75771
  transformedTextCache = /* @__PURE__ */ new Map();
75700
75772
  dispose() {
@@ -76002,7 +76074,7 @@ var init_almostnode_session = __esm({
76002
76074
  }
76003
76075
  if (this.vitePort !== null) {
76004
76076
  try {
76005
- getServerBridge().unregisterServer(this.vitePort);
76077
+ this.serverBridge?.unregisterServer(this.vitePort);
76006
76078
  } catch {
76007
76079
  }
76008
76080
  }
@@ -77258,7 +77330,8 @@ ${packages.map(([name2, version2]) => `+-- ${name2}@${version2}`).join("\n")}
77258
77330
  }
77259
77331
  }
77260
77332
  this.stopViteServer();
77261
- const bridge = getServerBridge();
77333
+ const bridge = await getServerBridge2();
77334
+ this.serverBridge = bridge;
77262
77335
  await ensureEsbuildWasm();
77263
77336
  this.viteServer = new ViteDevServer(this.vfs, { port, root: cwd });
77264
77337
  this.viteServer.start();
@@ -77352,8 +77425,7 @@ ${transformed}`;
77352
77425
  // src/pyodide-session.ts
77353
77426
  var pyodide_session_exports = {};
77354
77427
  __export(pyodide_session_exports, {
77355
- PyodideSession: () => PyodideSession,
77356
- createPyodideSession: () => createPyodideSession
77428
+ PyodideSession: () => PyodideSession
77357
77429
  });
77358
77430
  async function syncToEmscriptenFS(srcFs, emFs, srcPath, emPath) {
77359
77431
  try {
@@ -77435,9 +77507,6 @@ function parsePythonArgs(args) {
77435
77507
  }
77436
77508
  return { kind: "run-file", filePath: first };
77437
77509
  }
77438
- function createPyodideSession(fs2) {
77439
- return new PyodideSession(fs2);
77440
- }
77441
77510
  var PYODIDE_VERSION, PYODIDE_CDN_URL, PYTHON_VERSION, PIP_USAGE, PyodideSession;
77442
77511
  var init_pyodide_session = __esm({
77443
77512
  "src/pyodide-session.ts"() {
@@ -77484,16 +77553,6 @@ var init_pyodide_session = __esm({
77484
77553
  })();
77485
77554
  await this.initPromise;
77486
77555
  }
77487
- async syncWorkspaceToEmscriptenFS(cwd) {
77488
- if (!this.pyodide) return;
77489
- const workspaceRoot = this.getWorkspaceRoot(cwd);
77490
- await syncToEmscriptenFS(this.fs, this.pyodide.FS, workspaceRoot, workspaceRoot);
77491
- }
77492
- async syncWorkspaceFromEmscriptenFS(cwd) {
77493
- if (!this.pyodide) return;
77494
- const workspaceRoot = this.getWorkspaceRoot(cwd);
77495
- await syncFromEmscriptenFS(this.pyodide.FS, this.fs, workspaceRoot, workspaceRoot);
77496
- }
77497
77556
  getWorkspaceRoot(cwd) {
77498
77557
  const parts = cwd.split("/").filter(Boolean);
77499
77558
  return parts.length > 0 ? `/${parts[0]}` : "/workspace";
@@ -77520,7 +77579,8 @@ var init_pyodide_session = __esm({
77520
77579
  }
77521
77580
  await this.ensureInitialized();
77522
77581
  const pyodide = this.pyodide;
77523
- this.syncWorkspaceToEmscriptenFS(cwd);
77582
+ const workspaceRoot = this.getWorkspaceRoot(cwd);
77583
+ await syncToEmscriptenFS(this.fs, pyodide.FS, workspaceRoot, workspaceRoot);
77524
77584
  let stdout = "";
77525
77585
  let stderr = "";
77526
77586
  pyodide.setStdout({
@@ -77563,7 +77623,7 @@ os.chdir(${JSON.stringify(cwd)})
77563
77623
  }
77564
77624
  });
77565
77625
  await pyodide.runPythonAsync(code3);
77566
- this.syncWorkspaceFromEmscriptenFS(cwd);
77626
+ await syncFromEmscriptenFS(pyodide.FS, this.fs, workspaceRoot, workspaceRoot);
77567
77627
  return { stdout, stderr, exitCode: 0 };
77568
77628
  } catch (error) {
77569
77629
  const errorMsg = error instanceof Error ? error.message : String(error);
@@ -78542,8 +78602,8 @@ function createBrowserBashSession(options2 = {}) {
78542
78602
  async function getAlmostNodeSession() {
78543
78603
  if (almostNodeSession) return almostNodeSession;
78544
78604
  if (almostNodeSessionPromise) return almostNodeSessionPromise;
78545
- almostNodeSessionPromise = Promise.resolve().then(() => (init_almostnode_session(), almostnode_session_exports)).then(({ createAlmostNodeSession: createAlmostNodeSession2 }) => {
78546
- almostNodeSession = createAlmostNodeSession2(fs2);
78605
+ almostNodeSessionPromise = Promise.resolve().then(() => (init_almostnode_session(), almostnode_session_exports)).then((mod) => {
78606
+ almostNodeSession = new mod.AlmostNodeSession(fs2);
78547
78607
  almostNodeSession.setBinCommandRegistrar((name2, handler) => {
78548
78608
  bash.registerCommand(Dx(name2, handler));
78549
78609
  });
@@ -78555,8 +78615,8 @@ function createBrowserBashSession(options2 = {}) {
78555
78615
  async function getPyodideSession() {
78556
78616
  if (pyodideSession) return pyodideSession;
78557
78617
  if (pyodideSessionPromise) return pyodideSessionPromise;
78558
- pyodideSessionPromise = Promise.resolve().then(() => (init_pyodide_session(), pyodide_session_exports)).then(({ createPyodideSession: createPyodideSession2 }) => {
78559
- pyodideSession = createPyodideSession2(fs2);
78618
+ pyodideSessionPromise = Promise.resolve().then(() => (init_pyodide_session(), pyodide_session_exports)).then((mod) => {
78619
+ pyodideSession = new mod.PyodideSession(fs2);
78560
78620
  if (currentStdoutWriter) pyodideSession.setStdoutWriter(currentStdoutWriter);
78561
78621
  return pyodideSession;
78562
78622
  });
@@ -78666,11 +78726,9 @@ async function executeBrowserBash(session, command, options2 = {}) {
78666
78726
 
78667
78727
  // src/index.ts
78668
78728
  init_browser();
78669
- init_dist2();
78670
- var AGENT_WEB_OS_VERSION = "0.3.0-beta.0";
78729
+ init_server_bridge();
78730
+ var AGENT_WEB_OS_VERSION = "0.3.1";
78671
78731
  console.log(`[agent-web-os] v${AGENT_WEB_OS_VERSION}`);
78672
- var getServerBridge2 = getServerBridge;
78673
- var resetServerBridge2 = resetServerBridge;
78674
78732
  /*! Bundled license information:
78675
78733
 
78676
78734
  just-bash/dist/bundle/browser.js: