agent-web-os 0.1.19 → 0.2.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
@@ -1,6 +1,6 @@
1
1
  import * as just_bash from 'just-bash';
2
2
  import { InMemoryFs, FileContent, MkdirOptions, RmOptions, CpOptions } from 'just-bash';
3
- import { CommandContext, ExecResult, Bash, CustomCommand } from 'just-bash/browser';
3
+ import { Bash, CustomCommand, CommandContext, ExecResult } from 'just-bash/browser';
4
4
  export { Bash, CommandContext, CustomCommand, ExecResult, defineCommand } from 'just-bash/browser';
5
5
 
6
6
  type ObservableInMemoryFsWriteFileSyncOptions = Parameters<InMemoryFs["writeFileSync"]>[2];
@@ -67,149 +67,6 @@ declare class ObservableInMemoryFs extends InMemoryFs {
67
67
  utimes(path: string, atime: Date, mtime: Date): Promise<void>;
68
68
  }
69
69
 
70
- type BinCommandRegistrar = (name: string, handler: (args: string[], ctx: CommandContext) => Promise<ExecResult>) => void;
71
- type VitePreviewListener = (previewUrl: string | null) => void;
72
- type BatchFileLoader = (paths: string[]) => Promise<Map<string, Uint8Array>>;
73
- interface AlmostNodeSessionVfs {
74
- existsSync(path: string): boolean;
75
- statSync(path: string): {
76
- isDirectory(): boolean;
77
- isFile(): boolean;
78
- };
79
- readFileSync(path: string, encoding?: string): any;
80
- writeFileSync(path: string, data: string | Uint8Array): void;
81
- mkdirSync(path: string, options?: {
82
- recursive?: boolean;
83
- }): void;
84
- readdirSync(path: string): string[];
85
- unlinkSync(path: string): void;
86
- rmdirSync(path: string): void;
87
- renameSync(oldPath: string, newPath: string): void;
88
- }
89
- declare global {
90
- interface Window {
91
- __esbuild?: unknown;
92
- __esbuildInitPromise?: Promise<void>;
93
- }
94
- }
95
- declare class AlmostNodeSession {
96
- private readonly fs;
97
- private readonly _vfs;
98
- get vfs(): AlmostNodeSessionVfs;
99
- private readonly disposeObservableSubscription;
100
- private initializePromise;
101
- private initialized;
102
- private pendingOperations;
103
- private suppressObservableMirrorCount;
104
- private registeredBinCommands;
105
- private binCommandRegistrar?;
106
- private batchFileLoader?;
107
- private stdoutWriter?;
108
- private _stdinHandler;
109
- private _terminalColumns;
110
- private _terminalRows;
111
- private viteServer?;
112
- private vitePort;
113
- private vitePreviewUrl;
114
- private vitePreviewListener?;
115
- private parsedPackageJsonCache;
116
- private transformedTextCache;
117
- constructor(fs: ObservableInMemoryFs);
118
- dispose(): void;
119
- setBinCommandRegistrar(registrar: BinCommandRegistrar): void;
120
- setBatchFileLoader(loader: BatchFileLoader): void;
121
- setStdoutWriter(writer: ((data: string) => void) | undefined): void;
122
- /** Send data to the stdin of the currently running interactive process. */
123
- writeStdin(data: string): void;
124
- /** Update terminal dimensions (used for process.stdout.columns/rows). */
125
- setTerminalSize(columns: number, rows: number): void;
126
- setVitePreviewListener(listener: VitePreviewListener | undefined): void;
127
- setViteHmrTarget(target: Window | null): void;
128
- /**
129
- * Resolve a bare module specifier (e.g. "@mui/material" or "react") to a
130
- * `/node_modules/...` URL path that the ViteDevServer can serve.
131
- *
132
- * Resolution order mirrors Node/bundler conventions:
133
- * 1. package.json "exports" (condition "import" → "default")
134
- * 2. package.json "module"
135
- * 3. package.json "main"
136
- * 4. index.js / index.mjs fallback
137
- *
138
- * For deep imports like "@mui/material/Button", we resolve from the
139
- * package directory directly.
140
- */
141
- private resolveBarePkgEntryCache;
142
- private parseCachedPackageJson;
143
- private transformTextWithCache;
144
- private resolveBarePkgEntry;
145
- private _resolveBarePkgEntry;
146
- private resolveExportsEntry;
147
- /**
148
- * Handle wildcard exports like "./*" → { "default": { "default": "./esm/* /index.js" } }
149
- */
150
- private resolveWildcardExports;
151
- /**
152
- * Recursively resolve a condition value from an exports entry.
153
- * Handles: string, { import, module, default, require }, and nested conditions.
154
- * Skips "types" conditions since we need JS, not .d.ts files.
155
- *
156
- * Priority: browser > module > import > default > require
157
- * "browser" and "module" are preferred because they point to true ESM bundles.
158
- * "import" is deprioritised because some packages (e.g. @emotion/*) map it to
159
- * a CJS-to-ESM wrapper (.cjs.mjs) that uses require()/exports which fails
160
- * in a browser context.
161
- */
162
- private resolveConditionValue;
163
- /**
164
- * Rewrite bare import specifiers in JavaScript source to /node_modules/... paths.
165
- * When virtualPrefix is provided (e.g. "/__virtual__/5173"), prepends it to
166
- * resolved paths so the browser stays within the service-worker-routed URL
167
- * namespace and cascading relative imports keep going through the SW.
168
- */
169
- rewriteBareImports(code: string, root: string, virtualPrefix?: string): string;
170
- private serveExistingVirtualStaticFile;
171
- private stopViteServer;
172
- private resolveBinFromPackageJson;
173
- private resolveNpmBinPath;
174
- private resolveGlobalBinPath;
175
- /**
176
- * Replace lru-cache CJS entry points with a browser-safe implementation.
177
- *
178
- * lru-cache v11's minified CJS uses `require("node:diagnostics_channel")`
179
- * and private class fields (`static #t`) which can fail inside the browser
180
- * WASM runtime's `eval()` context, leaving `exports.LRUCache` undefined
181
- * ("TypeError: LRUCache is not a constructor").
182
- *
183
- * The fix: overwrite the CJS entry with a clean Map-based LRU cache that
184
- * covers the full API surface used by lru-cache consumers (hosted-git-info,
185
- * path-scurry, glob, etc.) without any diagnostics_channel dependency or
186
- * private class fields.
187
- */
188
- private patchLruCacheInNodeModules;
189
- private registerGlobalBinCommands;
190
- private resolveAndRegisterBinCommands;
191
- private trackOperation;
192
- private flushPendingOperations;
193
- private withSuppressedObservableMirroring;
194
- private copyObservablePathIntoVirtualFs;
195
- private getNodeModulesPackageRoot;
196
- private hydrateObservablePackageIntoVirtualFs;
197
- private hydrateObservablePathsIntoVirtualFs;
198
- private hydrateObservableDependencyPackagesIntoVirtualFs;
199
- private hydrateObservableProjectIntoVirtualFs;
200
- applyVirtualWrite(targetPath: string, data: string | Uint8Array): Promise<void>;
201
- applyVirtualMkdir(targetPath: string): Promise<void>;
202
- applyVirtualRemove(targetPath: string, recursive: boolean): Promise<void>;
203
- applyVirtualRename(previousPath: string, nextPath: string): Promise<void>;
204
- private ensureInitialized;
205
- private readPackageJson;
206
- private runNpmScript;
207
- executeNpm(args: string[], ctx: CommandContext): Promise<ExecResult>;
208
- executeNode(args: string[], ctx: CommandContext): Promise<ExecResult>;
209
- executeVite(args: string[], ctx: CommandContext): Promise<ExecResult>;
210
- }
211
- declare function createAlmostNodeSession(fs: ObservableInMemoryFs): AlmostNodeSession;
212
-
213
70
  /**
214
71
  * Shared types for agent-web-os.
215
72
  */
@@ -229,9 +86,11 @@ declare const DEFAULT_BASH_SHELL_ENV: {
229
86
  type BrowserBashSession = {
230
87
  fs: ObservableInMemoryFs;
231
88
  bash: Bash;
232
- almostNodeSession: AlmostNodeSession;
233
89
  rootPath: string;
234
90
  cwd: string;
91
+ setStdoutWriter: (writer: ((data: string) => void) | undefined) => void;
92
+ writeStdin: (data: string) => void;
93
+ setTerminalSize: (columns: number, rows: number) => void;
235
94
  dispose: () => void;
236
95
  };
237
96
  type BrowserBashSessionOptions = {
@@ -285,7 +144,7 @@ declare function executeBrowserBash(session: BrowserBashSession, command: string
285
144
 
286
145
  declare function executeFd(args: string[], ctx: CommandContext): Promise<ExecResult>;
287
146
 
288
- declare const AGENT_WEB_OS_VERSION = "0.1.19";
147
+ declare const AGENT_WEB_OS_VERSION = "0.2.1";
289
148
 
290
149
  type ServerBridge = {
291
150
  initServiceWorker(): Promise<void>;
@@ -296,4 +155,4 @@ type ServerBridge = {
296
155
  declare const getServerBridge: () => ServerBridge;
297
156
  declare const resetServerBridge: () => void;
298
157
 
299
- export { AGENT_WEB_OS_VERSION, AlmostNodeSession, type AlmostNodeSessionVfs, type BrowserBashSession, DEFAULT_BASH_SHELL_ENV, ObservableInMemoryFs, type ObservableInMemoryFsChangeEvent, type ObservableInMemoryFsChangeEventName, type ObservableInMemoryFsOptions, type ServerBridge, type ToolResult, assertObservableInMemoryFs, createAlmostNodeSession, createBrowserBashSession, executeBrowserBash, executeFd, getServerBridge, resetServerBridge };
158
+ export { AGENT_WEB_OS_VERSION, type BrowserBashSession, DEFAULT_BASH_SHELL_ENV, ObservableInMemoryFs, type ObservableInMemoryFsChangeEvent, type ObservableInMemoryFsChangeEventName, type ObservableInMemoryFsOptions, type ServerBridge, type ToolResult, assertObservableInMemoryFs, createBrowserBashSession, executeBrowserBash, executeFd, getServerBridge, resetServerBridge };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as just_bash from 'just-bash';
2
2
  import { InMemoryFs, FileContent, MkdirOptions, RmOptions, CpOptions } from 'just-bash';
3
- import { CommandContext, ExecResult, Bash, CustomCommand } from 'just-bash/browser';
3
+ import { Bash, CustomCommand, CommandContext, ExecResult } from 'just-bash/browser';
4
4
  export { Bash, CommandContext, CustomCommand, ExecResult, defineCommand } from 'just-bash/browser';
5
5
 
6
6
  type ObservableInMemoryFsWriteFileSyncOptions = Parameters<InMemoryFs["writeFileSync"]>[2];
@@ -67,149 +67,6 @@ declare class ObservableInMemoryFs extends InMemoryFs {
67
67
  utimes(path: string, atime: Date, mtime: Date): Promise<void>;
68
68
  }
69
69
 
70
- type BinCommandRegistrar = (name: string, handler: (args: string[], ctx: CommandContext) => Promise<ExecResult>) => void;
71
- type VitePreviewListener = (previewUrl: string | null) => void;
72
- type BatchFileLoader = (paths: string[]) => Promise<Map<string, Uint8Array>>;
73
- interface AlmostNodeSessionVfs {
74
- existsSync(path: string): boolean;
75
- statSync(path: string): {
76
- isDirectory(): boolean;
77
- isFile(): boolean;
78
- };
79
- readFileSync(path: string, encoding?: string): any;
80
- writeFileSync(path: string, data: string | Uint8Array): void;
81
- mkdirSync(path: string, options?: {
82
- recursive?: boolean;
83
- }): void;
84
- readdirSync(path: string): string[];
85
- unlinkSync(path: string): void;
86
- rmdirSync(path: string): void;
87
- renameSync(oldPath: string, newPath: string): void;
88
- }
89
- declare global {
90
- interface Window {
91
- __esbuild?: unknown;
92
- __esbuildInitPromise?: Promise<void>;
93
- }
94
- }
95
- declare class AlmostNodeSession {
96
- private readonly fs;
97
- private readonly _vfs;
98
- get vfs(): AlmostNodeSessionVfs;
99
- private readonly disposeObservableSubscription;
100
- private initializePromise;
101
- private initialized;
102
- private pendingOperations;
103
- private suppressObservableMirrorCount;
104
- private registeredBinCommands;
105
- private binCommandRegistrar?;
106
- private batchFileLoader?;
107
- private stdoutWriter?;
108
- private _stdinHandler;
109
- private _terminalColumns;
110
- private _terminalRows;
111
- private viteServer?;
112
- private vitePort;
113
- private vitePreviewUrl;
114
- private vitePreviewListener?;
115
- private parsedPackageJsonCache;
116
- private transformedTextCache;
117
- constructor(fs: ObservableInMemoryFs);
118
- dispose(): void;
119
- setBinCommandRegistrar(registrar: BinCommandRegistrar): void;
120
- setBatchFileLoader(loader: BatchFileLoader): void;
121
- setStdoutWriter(writer: ((data: string) => void) | undefined): void;
122
- /** Send data to the stdin of the currently running interactive process. */
123
- writeStdin(data: string): void;
124
- /** Update terminal dimensions (used for process.stdout.columns/rows). */
125
- setTerminalSize(columns: number, rows: number): void;
126
- setVitePreviewListener(listener: VitePreviewListener | undefined): void;
127
- setViteHmrTarget(target: Window | null): void;
128
- /**
129
- * Resolve a bare module specifier (e.g. "@mui/material" or "react") to a
130
- * `/node_modules/...` URL path that the ViteDevServer can serve.
131
- *
132
- * Resolution order mirrors Node/bundler conventions:
133
- * 1. package.json "exports" (condition "import" → "default")
134
- * 2. package.json "module"
135
- * 3. package.json "main"
136
- * 4. index.js / index.mjs fallback
137
- *
138
- * For deep imports like "@mui/material/Button", we resolve from the
139
- * package directory directly.
140
- */
141
- private resolveBarePkgEntryCache;
142
- private parseCachedPackageJson;
143
- private transformTextWithCache;
144
- private resolveBarePkgEntry;
145
- private _resolveBarePkgEntry;
146
- private resolveExportsEntry;
147
- /**
148
- * Handle wildcard exports like "./*" → { "default": { "default": "./esm/* /index.js" } }
149
- */
150
- private resolveWildcardExports;
151
- /**
152
- * Recursively resolve a condition value from an exports entry.
153
- * Handles: string, { import, module, default, require }, and nested conditions.
154
- * Skips "types" conditions since we need JS, not .d.ts files.
155
- *
156
- * Priority: browser > module > import > default > require
157
- * "browser" and "module" are preferred because they point to true ESM bundles.
158
- * "import" is deprioritised because some packages (e.g. @emotion/*) map it to
159
- * a CJS-to-ESM wrapper (.cjs.mjs) that uses require()/exports which fails
160
- * in a browser context.
161
- */
162
- private resolveConditionValue;
163
- /**
164
- * Rewrite bare import specifiers in JavaScript source to /node_modules/... paths.
165
- * When virtualPrefix is provided (e.g. "/__virtual__/5173"), prepends it to
166
- * resolved paths so the browser stays within the service-worker-routed URL
167
- * namespace and cascading relative imports keep going through the SW.
168
- */
169
- rewriteBareImports(code: string, root: string, virtualPrefix?: string): string;
170
- private serveExistingVirtualStaticFile;
171
- private stopViteServer;
172
- private resolveBinFromPackageJson;
173
- private resolveNpmBinPath;
174
- private resolveGlobalBinPath;
175
- /**
176
- * Replace lru-cache CJS entry points with a browser-safe implementation.
177
- *
178
- * lru-cache v11's minified CJS uses `require("node:diagnostics_channel")`
179
- * and private class fields (`static #t`) which can fail inside the browser
180
- * WASM runtime's `eval()` context, leaving `exports.LRUCache` undefined
181
- * ("TypeError: LRUCache is not a constructor").
182
- *
183
- * The fix: overwrite the CJS entry with a clean Map-based LRU cache that
184
- * covers the full API surface used by lru-cache consumers (hosted-git-info,
185
- * path-scurry, glob, etc.) without any diagnostics_channel dependency or
186
- * private class fields.
187
- */
188
- private patchLruCacheInNodeModules;
189
- private registerGlobalBinCommands;
190
- private resolveAndRegisterBinCommands;
191
- private trackOperation;
192
- private flushPendingOperations;
193
- private withSuppressedObservableMirroring;
194
- private copyObservablePathIntoVirtualFs;
195
- private getNodeModulesPackageRoot;
196
- private hydrateObservablePackageIntoVirtualFs;
197
- private hydrateObservablePathsIntoVirtualFs;
198
- private hydrateObservableDependencyPackagesIntoVirtualFs;
199
- private hydrateObservableProjectIntoVirtualFs;
200
- applyVirtualWrite(targetPath: string, data: string | Uint8Array): Promise<void>;
201
- applyVirtualMkdir(targetPath: string): Promise<void>;
202
- applyVirtualRemove(targetPath: string, recursive: boolean): Promise<void>;
203
- applyVirtualRename(previousPath: string, nextPath: string): Promise<void>;
204
- private ensureInitialized;
205
- private readPackageJson;
206
- private runNpmScript;
207
- executeNpm(args: string[], ctx: CommandContext): Promise<ExecResult>;
208
- executeNode(args: string[], ctx: CommandContext): Promise<ExecResult>;
209
- executeVite(args: string[], ctx: CommandContext): Promise<ExecResult>;
210
- }
211
- declare function createAlmostNodeSession(fs: ObservableInMemoryFs): AlmostNodeSession;
212
-
213
70
  /**
214
71
  * Shared types for agent-web-os.
215
72
  */
@@ -229,9 +86,11 @@ declare const DEFAULT_BASH_SHELL_ENV: {
229
86
  type BrowserBashSession = {
230
87
  fs: ObservableInMemoryFs;
231
88
  bash: Bash;
232
- almostNodeSession: AlmostNodeSession;
233
89
  rootPath: string;
234
90
  cwd: string;
91
+ setStdoutWriter: (writer: ((data: string) => void) | undefined) => void;
92
+ writeStdin: (data: string) => void;
93
+ setTerminalSize: (columns: number, rows: number) => void;
235
94
  dispose: () => void;
236
95
  };
237
96
  type BrowserBashSessionOptions = {
@@ -285,7 +144,7 @@ declare function executeBrowserBash(session: BrowserBashSession, command: string
285
144
 
286
145
  declare function executeFd(args: string[], ctx: CommandContext): Promise<ExecResult>;
287
146
 
288
- declare const AGENT_WEB_OS_VERSION = "0.1.19";
147
+ declare const AGENT_WEB_OS_VERSION = "0.2.1";
289
148
 
290
149
  type ServerBridge = {
291
150
  initServiceWorker(): Promise<void>;
@@ -296,4 +155,4 @@ type ServerBridge = {
296
155
  declare const getServerBridge: () => ServerBridge;
297
156
  declare const resetServerBridge: () => void;
298
157
 
299
- export { AGENT_WEB_OS_VERSION, AlmostNodeSession, type AlmostNodeSessionVfs, type BrowserBashSession, DEFAULT_BASH_SHELL_ENV, ObservableInMemoryFs, type ObservableInMemoryFsChangeEvent, type ObservableInMemoryFsChangeEventName, type ObservableInMemoryFsOptions, type ServerBridge, type ToolResult, assertObservableInMemoryFs, createAlmostNodeSession, createBrowserBashSession, executeBrowserBash, executeFd, getServerBridge, resetServerBridge };
158
+ export { AGENT_WEB_OS_VERSION, type BrowserBashSession, DEFAULT_BASH_SHELL_ENV, ObservableInMemoryFs, type ObservableInMemoryFsChangeEvent, type ObservableInMemoryFsChangeEventName, type ObservableInMemoryFsOptions, type ServerBridge, type ToolResult, assertObservableInMemoryFs, createBrowserBashSession, executeBrowserBash, executeFd, getServerBridge, resetServerBridge };