agent-web-os 0.4.0 → 0.4.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.
package/dist/index.d.cts CHANGED
@@ -29,6 +29,6 @@ import 'just-bash';
29
29
 
30
30
  declare function executeFd(args: string[], ctx: CommandContext): Promise<ExecResult>;
31
31
 
32
- declare const AGENT_WEB_OS_VERSION = "0.4.0";
32
+ declare const AGENT_WEB_OS_VERSION = "0.4.1";
33
33
 
34
34
  export { AGENT_WEB_OS_VERSION, executeFd };
package/dist/index.d.ts CHANGED
@@ -29,6 +29,6 @@ import 'just-bash';
29
29
 
30
30
  declare function executeFd(args: string[], ctx: CommandContext): Promise<ExecResult>;
31
31
 
32
- declare const AGENT_WEB_OS_VERSION = "0.4.0";
32
+ declare const AGENT_WEB_OS_VERSION = "0.4.1";
33
33
 
34
34
  export { AGENT_WEB_OS_VERSION, executeFd };
package/dist/index.js CHANGED
@@ -7,11 +7,11 @@ import {
7
7
  createBrowserBashSession,
8
8
  executeBrowserBash,
9
9
  executeFd
10
- } from "./chunk-ZZTRZYH2.js";
10
+ } from "./chunk-KBWDWVKH.js";
11
11
  import "./chunk-PR4QN5HX.js";
12
12
 
13
13
  // src/index.ts
14
- var AGENT_WEB_OS_VERSION = "0.4.0";
14
+ var AGENT_WEB_OS_VERSION = "0.4.1";
15
15
  console.log(`[agent-web-os] v${AGENT_WEB_OS_VERSION}`);
16
16
  export {
17
17
  AGENT_WEB_OS_VERSION,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const AGENT_WEB_OS_VERSION = \"0.4.0\"\r\nconsole.log(`[agent-web-os] v${AGENT_WEB_OS_VERSION}`)\r\n\r\nexport {\r\n ObservableInMemoryFs,\r\n assertObservableInMemoryFs,\r\n type ObservableInMemoryFsOptions,\r\n type ObservableInMemoryFsChangeEvent,\r\n type ObservableInMemoryFsChangeEventName,\r\n} from \"./observable-in-memory-fs\"\r\n\r\nexport {\r\n createBrowserBashSession,\r\n executeBrowserBash,\r\n DEFAULT_BASH_SHELL_ENV,\r\n type BrowserBashSession,\r\n} from \"./browser-bash-session\"\r\n\r\nexport { executeFd } from \"./fd-command\"\r\n\r\nexport type { ToolResult } from \"./types\"\r\n\r\n// Re-export just-bash/browser symbols so consumers don't need just-bash directly\r\nexport { Bash, defineCommand } from \"just-bash/browser\"\r\nexport type { CommandContext, ExecResult, CustomCommand } from \"just-bash/browser\"\r\n"],"mappings":";;;;;;;;;;;;;AAAO,IAAM,uBAAuB;AACpC,QAAQ,IAAI,mBAAmB,oBAAoB,EAAE;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const AGENT_WEB_OS_VERSION = \"0.4.1\"\r\nconsole.log(`[agent-web-os] v${AGENT_WEB_OS_VERSION}`)\r\n\r\nexport {\r\n ObservableInMemoryFs,\r\n assertObservableInMemoryFs,\r\n type ObservableInMemoryFsOptions,\r\n type ObservableInMemoryFsChangeEvent,\r\n type ObservableInMemoryFsChangeEventName,\r\n} from \"./observable-in-memory-fs\"\r\n\r\nexport {\r\n createBrowserBashSession,\r\n executeBrowserBash,\r\n DEFAULT_BASH_SHELL_ENV,\r\n type BrowserBashSession,\r\n} from \"./browser-bash-session\"\r\n\r\nexport { executeFd } from \"./fd-command\"\r\n\r\nexport type { ToolResult } from \"./types\"\r\n\r\n// Re-export just-bash/browser symbols so consumers don't need just-bash directly\r\nexport { Bash, defineCommand } from \"just-bash/browser\"\r\nexport type { CommandContext, ExecResult, CustomCommand } from \"just-bash/browser\"\r\n"],"mappings":";;;;;;;;;;;;;AAAO,IAAM,uBAAuB;AACpC,QAAQ,IAAI,mBAAmB,oBAAoB,EAAE;","names":[]}
package/dist/node.cjs CHANGED
@@ -60308,21 +60308,22 @@ ${importMap}`);
60308
60308
 
60309
60309
  // src/server-bridge.ts
60310
60310
  var globalBridge2 = null;
60311
+ var almostnodeModule = null;
60311
60312
  var almostnodePromise = null;
60312
- function loadAlmostnode() {
60313
- if (!almostnodePromise) {
60314
- almostnodePromise = Promise.resolve().then(() => (init_server_bridge(), server_bridge_exports));
60315
- }
60316
- return almostnodePromise;
60317
- }
60318
60313
  async function getServerBridge2() {
60314
+ if (!almostnodeModule) {
60315
+ if (!almostnodePromise) {
60316
+ almostnodePromise = Promise.resolve().then(() => (init_server_bridge(), server_bridge_exports));
60317
+ }
60318
+ almostnodeModule = await almostnodePromise;
60319
+ }
60319
60320
  if (!globalBridge2) {
60320
- const mod = await loadAlmostnode();
60321
- globalBridge2 = mod.getServerBridge();
60321
+ globalBridge2 = almostnodeModule.getServerBridge();
60322
60322
  }
60323
60323
  return globalBridge2;
60324
60324
  }
60325
60325
  function resetServerBridge2() {
60326
+ almostnodeModule?.resetServerBridge();
60326
60327
  globalBridge2 = null;
60327
60328
  }
60328
60329
 
@@ -60835,11 +60836,7 @@ var AlmostNodeSession = class {
60835
60836
  const cacheKey = `${root2}\0${specifier}`;
60836
60837
  const cached = this.resolveBarePkgEntryCache.get(cacheKey);
60837
60838
  if (cached !== void 0) return cached;
60838
- const result = this._resolveBarePkgEntry(specifier, root2);
60839
- this.resolveBarePkgEntryCache.set(cacheKey, result);
60840
- return result;
60841
- }
60842
- _resolveBarePkgEntry(specifier, root2) {
60839
+ let result = null;
60843
60840
  let pkgName;
60844
60841
  let subPath;
60845
60842
  if (specifier.startsWith("@")) {
@@ -60869,38 +60866,56 @@ var AlmostNodeSession = class {
60869
60866
  if (pkgJson?.exports && typeof pkgJson.exports === "object") {
60870
60867
  const exportsMap = pkgJson.exports;
60871
60868
  const entry = this.resolveExportsEntry(exportsMap, `./${subPath}`) ?? this.resolveWildcardExports(exportsMap, subPath);
60872
- if (entry) return `/node_modules/${pkgName}/${stripDotSlash(entry)}`;
60873
- }
60874
- const candidates = [
60875
- `/node_modules/${pkgName}/${subPath}`,
60876
- `/node_modules/${pkgName}/${subPath}.js`,
60877
- `/node_modules/${pkgName}/${subPath}.mjs`,
60878
- `/node_modules/${pkgName}/${subPath}/index.js`,
60879
- `/node_modules/${pkgName}/${subPath}/index.mjs`
60880
- ];
60881
- for (const candidate of candidates) {
60882
- if (this.vfs.existsSync(`${root2}${candidate}`)) return candidate;
60869
+ if (entry) {
60870
+ result = `/node_modules/${pkgName}/${stripDotSlash(entry)}`;
60871
+ }
60883
60872
  }
60884
- return `/node_modules/${pkgName}/${subPath}`;
60873
+ if (!result) {
60874
+ const candidates = [
60875
+ `/node_modules/${pkgName}/${subPath}`,
60876
+ `/node_modules/${pkgName}/${subPath}.js`,
60877
+ `/node_modules/${pkgName}/${subPath}.mjs`,
60878
+ `/node_modules/${pkgName}/${subPath}/index.js`,
60879
+ `/node_modules/${pkgName}/${subPath}/index.mjs`
60880
+ ];
60881
+ for (const candidate of candidates) {
60882
+ if (this.vfs.existsSync(`${root2}${candidate}`)) {
60883
+ result = candidate;
60884
+ break;
60885
+ }
60886
+ }
60887
+ }
60888
+ result ??= `/node_modules/${pkgName}/${subPath}`;
60889
+ this.resolveBarePkgEntryCache.set(cacheKey, result);
60890
+ return result;
60885
60891
  }
60886
60892
  if (pkgJson?.exports && typeof pkgJson.exports === "object") {
60887
60893
  const entry = this.resolveExportsEntry(pkgJson.exports, ".");
60888
- if (entry) return `/node_modules/${pkgName}/${stripDotSlash(entry)}`;
60894
+ if (entry) {
60895
+ result = `/node_modules/${pkgName}/${stripDotSlash(entry)}`;
60896
+ }
60889
60897
  }
60890
- if (typeof pkgJson?.module === "string") {
60891
- return `/node_modules/${pkgName}/${stripDotSlash(pkgJson.module)}`;
60898
+ if (!result && typeof pkgJson?.module === "string") {
60899
+ result = `/node_modules/${pkgName}/${stripDotSlash(pkgJson.module)}`;
60892
60900
  }
60893
- if (typeof pkgJson?.main === "string") {
60894
- return `/node_modules/${pkgName}/${stripDotSlash(pkgJson.main)}`;
60901
+ if (!result && typeof pkgJson?.main === "string") {
60902
+ result = `/node_modules/${pkgName}/${stripDotSlash(pkgJson.main)}`;
60895
60903
  }
60896
- const fallbacks = [
60897
- `/node_modules/${pkgName}/index.js`,
60898
- `/node_modules/${pkgName}/index.mjs`
60899
- ];
60900
- for (const fb2 of fallbacks) {
60901
- if (this.vfs.existsSync(`${root2}${fb2}`)) return fb2;
60904
+ if (!result) {
60905
+ const fallbacks = [
60906
+ `/node_modules/${pkgName}/index.js`,
60907
+ `/node_modules/${pkgName}/index.mjs`
60908
+ ];
60909
+ for (const fallbackPath of fallbacks) {
60910
+ if (this.vfs.existsSync(`${root2}${fallbackPath}`)) {
60911
+ result = fallbackPath;
60912
+ break;
60913
+ }
60914
+ }
60902
60915
  }
60903
- return `/node_modules/${pkgName}/index.js`;
60916
+ result ??= `/node_modules/${pkgName}/index.js`;
60917
+ this.resolveBarePkgEntryCache.set(cacheKey, result);
60918
+ return result;
60904
60919
  }
60905
60920
  resolveExportsEntry(exports, key) {
60906
60921
  const entry = exports[key];
@@ -63236,7 +63251,7 @@ function createBrowserBashSession(options2 = {}) {
63236
63251
  fs,
63237
63252
  customCommands: [
63238
63253
  ...runtimeCommands,
63239
- Dx("fd", async (args, ctx) => executeFd(args, ctx)),
63254
+ Dx("fd", executeFd),
63240
63255
  ...options2.customCommands ?? []
63241
63256
  ]
63242
63257
  });
@@ -63289,6 +63304,8 @@ async function enableNode(session) {
63289
63304
  return session;
63290
63305
  }
63291
63306
  const almostNodeSession = new AlmostNodeSession(session.fs);
63307
+ const executeNode = almostNodeSession.executeNode.bind(almostNodeSession);
63308
+ const executeNpm = almostNodeSession.executeNpm.bind(almostNodeSession);
63292
63309
  almostNodeSession.setBinCommandRegistrar((name, handler) => {
63293
63310
  session.bash.registerCommand(Dx(name, handler));
63294
63311
  });
@@ -63299,10 +63316,10 @@ async function enableNode(session) {
63299
63316
  dispose: () => almostNodeSession.dispose()
63300
63317
  });
63301
63318
  session.bash.registerCommand(
63302
- Dx("node", async (args, ctx) => almostNodeSession.executeNode(args, ctx))
63319
+ Dx("node", executeNode)
63303
63320
  );
63304
63321
  session.bash.registerCommand(
63305
- Dx("npm", async (args, ctx) => almostNodeSession.executeNpm(args, ctx))
63322
+ Dx("npm", executeNpm)
63306
63323
  );
63307
63324
  enabledNodeSessions.add(session);
63308
63325
  return session;