@almadar/workspace 0.11.4 → 0.11.5

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.
@@ -50,7 +50,11 @@ export declare function workspaceIndexManifestFile(workDir: string): string;
50
50
  * Resolve a user-supplied relative path within the sandbox. Rejects
51
51
  * absolute paths, `..` traversal, and any path that resolves outside
52
52
  * `workDir`. Returns the absolute resolved path on success.
53
+ *
54
+ * When `mounts` is supplied, path prefixes like `@std/…` resolve against
55
+ * the mount's absolute root instead of `workDir`. Mounts bypass the
56
+ * `workDir` traversal guard but enforce their own.
53
57
  */
54
- export declare function sandboxedPath(workDir: string, relPath: string): string;
58
+ export declare function sandboxedPath(workDir: string, relPath: string, mounts?: ReadonlyMap<string, string>): string;
55
59
  /** Validate an orbital logical name — no path separators, no `..`. */
56
60
  export declare function assertOrbitalName(name: string): void;
package/dist/service.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  import type { JsonObject, JsonValue } from '@almadar/core';
10
- import type { FileTreeNode, GitHubConfig, GitStatusInfo, InstantiateWorkspaceSeed, SnapshotMeta, WorkspaceArchiveBackend, WorkspaceObserver, WorkspaceService, WorkspaceWatchEvent } from './types.js';
10
+ import type { FileTreeNode, GitHubConfig, GitStatusInfo, InstantiateWorkspaceSeed, MountEntry, SnapshotMeta, WorkspaceArchiveBackend, WorkspaceObserver, WorkspaceService, WorkspaceWatchEvent } from './types.js';
11
11
  import type { WorkspaceBackend } from './internal/types.js';
12
12
  import { SinkManager } from './internal/sink-manager.js';
13
13
  import { GitClient } from './internal/git-client.js';
@@ -21,6 +21,7 @@ interface ServiceCtorArgs {
21
21
  git?: GitClient;
22
22
  github?: GitHubConfig;
23
23
  archiveBackend?: WorkspaceArchiveBackend;
24
+ mounts?: MountEntry[];
24
25
  }
25
26
  export declare class WorkspaceServiceImpl implements WorkspaceService {
26
27
  readonly workDir: string;
@@ -32,6 +33,8 @@ export declare class WorkspaceServiceImpl implements WorkspaceService {
32
33
  private readonly archiveBackend;
33
34
  /** Per-absolute-path serial queue. */
34
35
  private readonly writeQueue;
36
+ /** Mount prefix → resolved absolute directory. Built from constructor `mounts` + runtime `mountReadonly`. */
37
+ private readonly mountMap;
35
38
  readonly index: WorkspaceIndex;
36
39
  constructor(args: ServiceCtorArgs);
37
40
  get appId(): string | undefined;
@@ -86,6 +89,12 @@ export declare class WorkspaceServiceImpl implements WorkspaceService {
86
89
  removeFile(relPath: string): Promise<void>;
87
90
  listTree(relPath?: string): Promise<FileTreeNode[]>;
88
91
  exists(relPath: string): Promise<boolean>;
92
+ mountReadonly(prefix: string, absPath: string): void;
93
+ isMounted(relPath: string): boolean;
94
+ /** Resolve a sandboxed path through mounts. */
95
+ private sandbox;
96
+ /** Throw if relPath resolves to a mount (write/remove are blocked). */
97
+ private assertNotMounted;
89
98
  commitAndPush(opts: {
90
99
  message: string;
91
100
  tags?: string[];
package/dist/types.d.ts CHANGED
@@ -173,6 +173,13 @@ export interface FileTreeNode {
173
173
  /** Byte size for files; `0` for directories. */
174
174
  size: number;
175
175
  }
176
+ /** Read-only mount entry — makes an external absolute directory available under a workspace-prefix path. */
177
+ export interface MountEntry {
178
+ /** Workspace-relative prefix, e.g. `@std`. Must not contain path separators or `..`. */
179
+ prefix: string;
180
+ /** Absolute path to the backing directory on the local filesystem. */
181
+ absPath: string;
182
+ }
176
183
  /**
177
184
  * Factory input. Lifecycle resolution order: `adopt` → resume-from-disk →
178
185
  * `restore` backend → `github` clone → mint fresh.
@@ -213,6 +220,13 @@ export interface OpenWorkspaceOptions {
213
220
  create?: boolean;
214
221
  /** Storage selector. `'memory'` is for tests; `'local'` is default. */
215
222
  backend?: 'local' | 'memory';
223
+ /**
224
+ * Read-only mounts — expose external absolute directories under
225
+ * workspace-relative path prefixes (e.g. `@std` → `/path/to/std`).
226
+ * ReadFile / listTree / exists resolve through mounts transparently;
227
+ * writeFile / removeFile reject mounted paths.
228
+ */
229
+ mounts?: MountEntry[];
216
230
  /** Optional project name baked into the mint-time schema template. */
217
231
  projectName?: string;
218
232
  /**
@@ -329,6 +343,14 @@ export interface WorkspaceService {
329
343
  removeFile(relPath: string): Promise<void>;
330
344
  listTree(relPath?: string): Promise<FileTreeNode[]>;
331
345
  exists(relPath: string): Promise<boolean>;
346
+ /**
347
+ * Add a read-only mount at runtime — makes an external absolute directory
348
+ * available under a workspace-path prefix. ReadFile / listTree / exists
349
+ * resolve through the mount transparently; writeFile / removeFile reject it.
350
+ */
351
+ mountReadonly(prefix: string, absPath: string): void;
352
+ /** True when `relPath` resolves to a read-only mount. */
353
+ isMounted(relPath: string): boolean;
332
354
  commitAndPush(opts: {
333
355
  message: string;
334
356
  tags?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/workspace",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "Storage-agnostic workspace primitives shared by Almadar consumers. One service, six exports, hidden paths, single observer. See docs/Almadar_Workspace.md.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "license": "BUSL-1.1",
27
27
  "dependencies": {
28
- "@almadar/core": ">=9.6.1",
29
- "@almadar/llm": "^2.16.0",
28
+ "@almadar/core": "^10.26.0",
29
+ "@almadar/llm": "^2.31.0",
30
30
  "dugite": "^3.2.2",
31
31
  "typescript": "^5.4.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@almadar/eslint-plugin": ">=2.7.0",
34
+ "@almadar/eslint-plugin": "^2.14.0",
35
35
  "@types/node": "^22.0.0",
36
36
  "@typescript-eslint/parser": "8.56.0",
37
37
  "eslint": "^10.0.0",