@orkestrel/workspace 0.0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/src/core/index.cjs +976 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +701 -0
- package/dist/src/core/index.d.ts +701 -0
- package/dist/src/core/index.js +946 -0
- package/dist/src/core/index.js.map +1 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orkestrel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @orkestrel/workspace
|
|
2
|
+
|
|
3
|
+
The virtual file workspace for the `@orkestrel` line.
|
|
4
|
+
|
|
5
|
+
A workspace is a path-keyed map of immutable files with an editing surface over it: write, read,
|
|
6
|
+
search, replace, move, remove. Every edit mints a new file value and puts it back under its path,
|
|
7
|
+
so a file is a value a caller can hold and compare rather than a handle that changes underneath it.
|
|
8
|
+
Around that map sit a registry of named workspaces with one active selection, and pluggable stores
|
|
9
|
+
that persist plain snapshots.
|
|
10
|
+
|
|
11
|
+
It is not a filesystem. There is no disk, no `node:fs`, no watcher, no synchronization lifecycle,
|
|
12
|
+
and no dirty-state tracking — a path is a key, not a location. Durability is a separate seam: a
|
|
13
|
+
snapshot is a plain serializable value, and a store is the thing that keeps one.
|
|
14
|
+
|
|
15
|
+
Nothing here is model-specific. An agent loop, a tool handler, and plain application code are all
|
|
16
|
+
just callers.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install @orkestrel/workspace
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createWorkspaceManager } from '@orkestrel/workspace'
|
|
28
|
+
|
|
29
|
+
const workspaces = createWorkspaceManager()
|
|
30
|
+
const workspace = workspaces.add({ id: 'project' }) // the first add becomes active
|
|
31
|
+
|
|
32
|
+
workspace.write('src/main.ts', 'export const answer = 42')
|
|
33
|
+
workspace.append('src/main.ts', '\n')
|
|
34
|
+
|
|
35
|
+
workspace.read('src/main.ts') // 'export const answer = 42\n'
|
|
36
|
+
workspace.search('answer') // one match, with its 1-based line and column
|
|
37
|
+
workspace.snapshot() // { id: 'project', files: [ … ] } — serializable, ready for a store
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Ranged edits clamp to the text they address, search is literal until you ask for a pattern, and an
|
|
41
|
+
absent path answers with `undefined` instead of throwing. Give the manager a store and `save` and
|
|
42
|
+
`open` round-trip a workspace through it.
|
|
43
|
+
|
|
44
|
+
See the [workspace guide](guides/src/workspace.md) for the complete surface, edit semantics,
|
|
45
|
+
events, and stores.
|
|
46
|
+
|
|
47
|
+
## Requirements
|
|
48
|
+
|
|
49
|
+
- Node.js 22.12 or newer
|
|
50
|
+
- ESM and CommonJS consumers
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](LICENSE).
|