arborkit 1.0.0 → 1.1.0
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/CHANGELOG.md +29 -0
- package/README.md +8 -0
- package/dist/addressing.js +4 -52
- package/dist/addressing.js.map +1 -1
- package/dist/ag-ui.js +6 -44
- package/dist/ag-ui.js.map +1 -1
- package/dist/arbor.js +25 -1537
- package/dist/arbor.js.map +1 -1
- package/dist/artifact-tree.js +5 -281
- package/dist/artifact-tree.js.map +1 -1
- package/dist/chunk-2UY5KJ5P.js +72 -0
- package/dist/chunk-2UY5KJ5P.js.map +1 -0
- package/dist/chunk-32FKMLEA.js +117 -0
- package/dist/chunk-32FKMLEA.js.map +1 -0
- package/dist/chunk-3BWK5SLN.js +22 -0
- package/dist/chunk-3BWK5SLN.js.map +1 -0
- package/dist/chunk-53XPRLFF.js +213 -0
- package/dist/chunk-53XPRLFF.js.map +1 -0
- package/dist/chunk-55J6XMHW.js +1 -0
- package/dist/chunk-55J6XMHW.js.map +1 -0
- package/dist/chunk-6DOI4FNX.js +18 -0
- package/dist/chunk-6DOI4FNX.js.map +1 -0
- package/dist/chunk-AGPH62II.js +78 -0
- package/dist/chunk-AGPH62II.js.map +1 -0
- package/dist/chunk-BYXJ5B5F.js +40 -0
- package/dist/chunk-BYXJ5B5F.js.map +1 -0
- package/dist/chunk-DQW5EEWU.js +20 -0
- package/dist/chunk-DQW5EEWU.js.map +1 -0
- package/dist/chunk-I4NLMLE2.js +43 -0
- package/dist/chunk-I4NLMLE2.js.map +1 -0
- package/dist/chunk-KRJCSJL4.js +208 -0
- package/dist/chunk-KRJCSJL4.js.map +1 -0
- package/dist/chunk-L4HFSLBD.js +112 -0
- package/dist/chunk-L4HFSLBD.js.map +1 -0
- package/dist/chunk-M72UOSPG.js +43 -0
- package/dist/chunk-M72UOSPG.js.map +1 -0
- package/dist/chunk-OZCCBVUV.js +50 -0
- package/dist/chunk-OZCCBVUV.js.map +1 -0
- package/dist/chunk-QRGDUGY6.js +143 -0
- package/dist/chunk-QRGDUGY6.js.map +1 -0
- package/dist/chunk-QWYVTW2C.js +70 -0
- package/dist/chunk-QWYVTW2C.js.map +1 -0
- package/dist/chunk-TEJZF3IR.js +24 -0
- package/dist/chunk-TEJZF3IR.js.map +1 -0
- package/dist/chunk-U3NXJNUY.js +23 -0
- package/dist/chunk-U3NXJNUY.js.map +1 -0
- package/dist/chunk-UTJZYWK3.js +272 -0
- package/dist/chunk-UTJZYWK3.js.map +1 -0
- package/dist/chunk-V3HDDWER.js +60 -0
- package/dist/chunk-V3HDDWER.js.map +1 -0
- package/dist/chunk-VG5BEOBI.js +34 -0
- package/dist/chunk-VG5BEOBI.js.map +1 -0
- package/dist/chunk-VGHBPFCV.js +18 -0
- package/dist/chunk-VGHBPFCV.js.map +1 -0
- package/dist/chunk-WEO5KBRI.js +148 -0
- package/dist/chunk-WEO5KBRI.js.map +1 -0
- package/dist/chunk-XT7WR7OF.js +23 -0
- package/dist/chunk-XT7WR7OF.js.map +1 -0
- package/dist/chunk-XWCA5XHZ.js +12 -0
- package/dist/chunk-XWCA5XHZ.js.map +1 -0
- package/dist/chunk-YCDDDYGG.js +22 -0
- package/dist/chunk-YCDDDYGG.js.map +1 -0
- package/dist/chunk-YWY2EK2Q.js +40 -0
- package/dist/chunk-YWY2EK2Q.js.map +1 -0
- package/dist/chunk-ZBBMJMLG.js +33 -0
- package/dist/chunk-ZBBMJMLG.js.map +1 -0
- package/dist/chunk-ZDANDXJ6.js +148 -0
- package/dist/chunk-ZDANDXJ6.js.map +1 -0
- package/dist/clock.js +4 -18
- package/dist/clock.js.map +1 -1
- package/dist/decompose.js +5 -16
- package/dist/decompose.js.map +1 -1
- package/dist/delta-storage.js +5 -101
- package/dist/delta-storage.js.map +1 -1
- package/dist/delta.js +15 -732
- package/dist/delta.js.map +1 -1
- package/dist/embedding-port.js +3 -17
- package/dist/embedding-port.js.map +1 -1
- package/dist/embedding-text.js +4 -16
- package/dist/embedding-text.js.map +1 -1
- package/dist/errors.js +8 -50
- package/dist/errors.js.map +1 -1
- package/dist/event-log.js +4 -78
- package/dist/event-log.js.map +1 -1
- package/dist/file-storage.js +3 -38
- package/dist/file-storage.js.map +1 -1
- package/dist/ids.js +4 -17
- package/dist/ids.js.map +1 -1
- package/dist/index.js +117 -1763
- package/dist/index.js.map +1 -1
- package/dist/json-edit.js +10 -75
- package/dist/json-edit.js.map +1 -1
- package/dist/jsonpointer.js +8 -24
- package/dist/jsonpointer.js.map +1 -1
- package/dist/mutator.js +5 -240
- package/dist/mutator.js.map +1 -1
- package/dist/navigator.js +7 -188
- package/dist/navigator.js.map +1 -1
- package/dist/path-glob.js +5 -35
- package/dist/path-glob.js.map +1 -1
- package/dist/registry-validator.js +3 -7
- package/dist/registry-validator.js.map +1 -1
- package/dist/replay.js +6 -179
- package/dist/replay.js.map +1 -1
- package/dist/semantic-index.js +5 -222
- package/dist/semantic-index.js.map +1 -1
- package/dist/storage.js +9 -372
- package/dist/storage.js.map +1 -1
- package/dist/toolset.d.ts +10 -0
- package/dist/toolset.js +8 -302
- package/dist/toolset.js.map +1 -1
- package/dist/type-aware-decision.js +3 -13
- package/dist/type-aware-decision.js.map +1 -1
- package/dist/type-registry.js +3 -13
- package/dist/type-registry.js.map +1 -1
- package/dist/types.js +1 -0
- package/dist/vector-index-port.js +3 -45
- package/dist/vector-index-port.js.map +1 -1
- package/dist/zod-adapter.js +4 -30
- package/dist/zod-adapter.js.map +1 -1
- package/package.json +128 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 — 2026-07-05
|
|
4
|
+
|
|
5
|
+
- **New patch op: `edit`** — exact-substring surgery on string-valued nodes:
|
|
6
|
+
`patch(ref, { op: "edit", old, new, replaceAll?, ifVersion? })`. `old` must occur
|
|
7
|
+
exactly once in the node's string value (or set `replaceAll`); on a miss or an
|
|
8
|
+
ambiguous match the op fails with a structured `INVALID_OP` that reports the
|
|
9
|
+
occurrence count, so an agent can re-quote a larger fragment and retry.
|
|
10
|
+
Replacement is literal (no `$&`-style pattern expansion). Scope and `ifVersion`
|
|
11
|
+
are enforced *before* any content inspection — out-of-scope probes get an
|
|
12
|
+
identical `SCOPE_VIOLATION` whether or not `old` matches, leaking nothing.
|
|
13
|
+
- Under the hood `edit` is pure sugar over `set`: the event log records an ordinary
|
|
14
|
+
`set` with full before/after, so replay, revert, delta persistence, and the AG-UI
|
|
15
|
+
adapter need no changes.
|
|
16
|
+
- Motivation: output tokens are ~5× input price on current Claude models. An agent
|
|
17
|
+
quoting `old`/`new` fragments (~100 output tokens) instead of regenerating a whole
|
|
18
|
+
block (~1500) is the dominant cost lever for agent-driven editing. Pattern: `get`
|
|
19
|
+
the node first, quote `old` from the live value — the Claude Code `Edit`-tool
|
|
20
|
+
semantics.
|
|
21
|
+
|
|
22
|
+
## 1.0.1 — 2026-07-03
|
|
23
|
+
|
|
24
|
+
- **Fix: cross-entry `instanceof` breakage.** 1.0.0 was built without code splitting, so every
|
|
25
|
+
subpath entry (`arborkit/errors`, `arborkit/toolset`, …) bundled its own copies of shared
|
|
26
|
+
classes — mixing root and subpath imports broke `instanceof` (e.g. the toolset degraded
|
|
27
|
+
`SCOPE_VIOLATION` results to generic `ERROR` against a `Mutator` imported from another entry).
|
|
28
|
+
Splitting is now enabled; shared chunks give one class identity across all entries.
|
|
29
|
+
- Chunk files stay private: the `"./*"` wildcard export is replaced by an explicit per-module
|
|
30
|
+
exports map, so hash-named chunks are not importable. All documented entry points are unchanged.
|
|
31
|
+
|
|
3
32
|
## 1.0.0 — 2026-07-03
|
|
4
33
|
|
|
5
34
|
First public release of Arbor as `arborkit`. The milestone arc:
|
package/README.md
CHANGED
|
@@ -44,6 +44,14 @@ const home = await tools.get({ path: "/pages/home" }); // home.value.content ===
|
|
|
44
44
|
const refused = await tools.patch({ path: "/plan" }, { op: "set", value: "hacked" });
|
|
45
45
|
// refused.ok === false — out of scope; violations are returned, never thrown
|
|
46
46
|
|
|
47
|
+
// Agent edits — surgical substring replacement instead of regenerating a block:
|
|
48
|
+
// get the node first, quote `old` from the live value (Claude Code Edit semantics).
|
|
49
|
+
await tools.patch({ path: "/pages/home" }, { op: "set", value: { title: "Home", html: "<p>Bonus: 100% do 2000 PLN</p>" } });
|
|
50
|
+
const edited = await tools.patch(
|
|
51
|
+
{ path: "/pages/home/html" },
|
|
52
|
+
{ op: "edit", old: "100% do 2000 PLN", new: "150% do 3000 PLN" },
|
|
53
|
+
); // unique-or-fail: an ambiguous `old` returns INVALID_OP with the occurrence count
|
|
54
|
+
|
|
47
55
|
// Semantic search — mutations only mark nodes stale; reindex() embeds:
|
|
48
56
|
await arbor.index!.reindex();
|
|
49
57
|
const found = await arbor.index!.search("home page"); // { results, staleCount }
|
package/dist/addressing.js
CHANGED
|
@@ -1,55 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function decodeSegment(s) {
|
|
6
|
-
return s.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
7
|
-
}
|
|
8
|
-
function buildPointer(segments) {
|
|
9
|
-
if (segments.length === 0) return "";
|
|
10
|
-
return "/" + segments.map((s) => encodeSegment(String(s))).join("/");
|
|
11
|
-
}
|
|
12
|
-
function parsePointer(pointer) {
|
|
13
|
-
if (pointer === "") return [];
|
|
14
|
-
if (!pointer.startsWith("/")) {
|
|
15
|
-
throw new Error(`Invalid JSON Pointer (must be "" or start with "/"): ${pointer}`);
|
|
16
|
-
}
|
|
17
|
-
return pointer.slice(1).split("/").map(decodeSegment);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// src/addressing.ts
|
|
21
|
-
var Addressing = class {
|
|
22
|
-
constructor(tree) {
|
|
23
|
-
this.tree = tree;
|
|
24
|
-
}
|
|
25
|
-
tree;
|
|
26
|
-
byId(id) {
|
|
27
|
-
return this.tree.get(id);
|
|
28
|
-
}
|
|
29
|
-
/** Compute the JSON Pointer for a node by walking parent links to the root. */
|
|
30
|
-
pathOf(id) {
|
|
31
|
-
const cur0 = this.tree.get(id);
|
|
32
|
-
if (!cur0) throw new Error(`Unknown node: ${id}`);
|
|
33
|
-
const segments = [];
|
|
34
|
-
let cur = cur0;
|
|
35
|
-
while (cur && cur.parentId !== null) {
|
|
36
|
-
segments.unshift(cur.key);
|
|
37
|
-
cur = this.tree.get(cur.parentId);
|
|
38
|
-
}
|
|
39
|
-
return buildPointer(segments);
|
|
40
|
-
}
|
|
41
|
-
/** Resolve a JSON Pointer to a node, or undefined if any segment is missing. */
|
|
42
|
-
byPath(pointer) {
|
|
43
|
-
const segments = parsePointer(pointer);
|
|
44
|
-
let cur = this.tree.root();
|
|
45
|
-
for (const seg of segments) {
|
|
46
|
-
if (!cur) return void 0;
|
|
47
|
-
cur = this.tree.childByKey(cur.id, seg);
|
|
48
|
-
if (!cur) return void 0;
|
|
49
|
-
}
|
|
50
|
-
return cur;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
Addressing
|
|
3
|
+
} from "./chunk-M72UOSPG.js";
|
|
4
|
+
import "./chunk-VG5BEOBI.js";
|
|
53
5
|
export {
|
|
54
6
|
Addressing
|
|
55
7
|
};
|
package/dist/addressing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/ag-ui.js
CHANGED
|
@@ -1,47 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
code;
|
|
9
|
-
};
|
|
10
|
-
var InvalidOpError = class extends ArborError {
|
|
11
|
-
constructor(message) {
|
|
12
|
-
super("INVALID_OP", message);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// src/ag-ui.ts
|
|
17
|
-
function toJsonPatch(e) {
|
|
18
|
-
switch (e.kind) {
|
|
19
|
-
case "set":
|
|
20
|
-
return e.path === void 0 ? null : { op: "replace", path: e.path, value: e.after ?? null };
|
|
21
|
-
case "insert":
|
|
22
|
-
return e.path === void 0 ? null : { op: "add", path: e.path, value: e.after ?? null };
|
|
23
|
-
case "remove":
|
|
24
|
-
return e.path === void 0 ? null : { op: "remove", path: e.path };
|
|
25
|
-
case "move":
|
|
26
|
-
return e.fromPath === void 0 || e.toPath === void 0 ? null : { op: "move", from: e.fromPath, path: e.toPath };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function snapshotEvent(tree) {
|
|
30
|
-
return { type: "STATE_SNAPSHOT", snapshot: tree.toJson() };
|
|
31
|
-
}
|
|
32
|
-
function deltaSince(log, sinceSeq) {
|
|
33
|
-
if (sinceSeq < log.baseSeqValue()) {
|
|
34
|
-
throw new InvalidOpError(
|
|
35
|
-
`deltaSince: events [${sinceSeq}, ${log.baseSeqValue()}) were compacted away \u2014 send a fresh STATE_SNAPSHOT instead`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
const delta = [];
|
|
39
|
-
for (const e of log.since(sinceSeq)) {
|
|
40
|
-
const op = toJsonPatch(e);
|
|
41
|
-
if (op) delta.push(op);
|
|
42
|
-
}
|
|
43
|
-
return { event: { type: "STATE_DELTA", delta }, nextSeq: log.length() };
|
|
44
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
deltaSince,
|
|
3
|
+
snapshotEvent,
|
|
4
|
+
toJsonPatch
|
|
5
|
+
} from "./chunk-BYXJ5B5F.js";
|
|
6
|
+
import "./chunk-V3HDDWER.js";
|
|
45
7
|
export {
|
|
46
8
|
deltaSince,
|
|
47
9
|
snapshotEvent,
|
package/dist/ag-ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|