@storacha/clawracha 0.1.20 → 0.1.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/handlers/process.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAEZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM5D,8DAA8D;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzD,wBAAsB,cAAc,CAClC,OAAO,EAAE,UAAU,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkFnB"}
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/handlers/process.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EAEZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM5D,8DAA8D;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAIzD,wBAAsB,cAAc,CAClC,OAAO,EAAE,UAAU,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,SAAS,EACf,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAoFnB"}
@@ -12,7 +12,6 @@ import * as path from "node:path";
12
12
  const isMarkdown = (filePath) => filePath.endsWith(".md");
13
13
  export async function processChanges(changes, workspace, current, blocks, sink, store) {
14
14
  const pendingOps = [];
15
- console.log("Processing changes:", JSON.stringify(changes, null, 2));
16
15
  const mdChanges = changes.filter((c) => isMarkdown(c.path));
17
16
  const regularChanges = changes.filter((c) => !isMarkdown(c.path));
18
17
  // --- Regular files (UnixFS encode) ---
@@ -52,9 +51,13 @@ export async function processChanges(changes, workspace, current, blocks, sink,
52
51
  const mdPuts = mdChanges.filter((c) => c.type !== "unlink");
53
52
  for (const change of mdPuts) {
54
53
  const content = await fs.readFile(path.join(workspace, change.path), "utf-8");
55
- const { mdEntryCid, additions } = current
54
+ const newEntry = current
56
55
  ? await mdsync.put(blocks, current, change.path, content)
57
56
  : await mdsync.v0Put(content);
57
+ if (!newEntry) {
58
+ continue; // No change detected, skip writing a new entry.
59
+ }
60
+ const { mdEntryCid, additions } = newEntry;
58
61
  // Sink blocks to CAR for upload, and store locally for future resolveValue calls.
59
62
  for (const block of additions) {
60
63
  await sink(block);
@@ -35,7 +35,7 @@ export declare const v0Put: (newMarkdown: string) => Promise<MarkdownResult>;
35
35
  * Returns the markdown entry CID and blocks to store. Caller is
36
36
  * responsible for creating the Pail revision via Revision.put.
37
37
  */
38
- export declare const put: (blocks: BlockFetcher, current: ValueView, key: string, newMarkdown: string) => Promise<MarkdownResult>;
38
+ export declare const put: (blocks: BlockFetcher, current: ValueView, key: string, newMarkdown: string) => Promise<MarkdownResult | null>;
39
39
  /**
40
40
  * Get the current markdown string for a key, resolving concurrent heads.
41
41
  * Returns undefined if the key doesn't exist.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdsync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,YAAY,EAGZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAoJ1C,UAAU,cAAc;IACtB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,KAAK,EAAE,CAAC;CACpB;AAyBD;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAChB,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,CAExB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,EACX,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,CA+BxB,CAAC;AA6RF;;;GAGG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,KACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdsync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,YAAY,EAGZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAsJ1C,UAAU,cAAc;IACtB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,KAAK,EAAE,CAAC;CACpB;AAyBD;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,cAAc,CAEvE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,EACX,aAAa,MAAM,KAClB,OAAO,CAAC,cAAc,GAAG,IAAI,CAkC/B,CAAC;AA0RF;;;GAGG;AACH,eAAO,MAAM,GAAG,GACd,QAAQ,YAAY,EACpB,SAAS,SAAS,EAClB,KAAK,MAAM,KACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAM5B,CAAC"}
@@ -131,6 +131,9 @@ export const put = async (blocks, current, key, newMarkdown) => {
131
131
  eventRGA.insert(orderedNodes[orderedNodes.length - 1].id, mdEvent, mdEvent);
132
132
  // Diff the current tree against the new markdown and apply.
133
133
  const changeset = computeChangeSet(rgaRoot, newMarkdown, mdEvent);
134
+ if (changeset.changes.length === 0) {
135
+ return null; // No changes to apply, skip writing a new entry.
136
+ }
134
137
  const comparator = makeComparator(eventRGA);
135
138
  const newRoot = applyRGAChangeSet(rgaRoot, changeset, comparator);
136
139
  return serializeMarkdownEntry({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,qBAAqB,CAAC;AAkJ7B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,GAAG,EAAE,iBAAiB,QAwmBpD"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,qBAAqB,CAAC;AAmJ7B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,GAAG,EAAE,iBAAiB,QAomBpD"}
package/dist/plugin.js CHANGED
@@ -17,6 +17,7 @@ import { resolveAgentWorkspace, getAgentIds } from "./utils/workspace.js";
17
17
  import { Agent, Name } from "@storacha/ucn/pail";
18
18
  import { extract } from "@storacha/client/delegation";
19
19
  import * as z from "zod";
20
+ import { spaceAccess } from "@storacha/client/capability/access";
20
21
  const activeSyncers = new Map();
21
22
  // --- Config helpers ---
22
23
  const UpdateParams = z.object({
@@ -446,12 +447,9 @@ export default function plugin(api) {
446
447
  const audience = {
447
448
  did: () => targetDID,
448
449
  };
449
- const uploadDel = await storachaClient.createDelegation(audience, [
450
- "space/blob/add",
451
- "space/index/add",
452
- "upload/add",
453
- "filecoin/offer",
454
- ]);
450
+ const uploadDel = await storachaClient.createDelegation(audience,
451
+ // @ts-expect-error createDelegation should validate abilities
452
+ Object.keys(spaceAccess));
455
453
  const { ok: archiveBytes } = await uploadDel.archive();
456
454
  if (archiveBytes) {
457
455
  results.push(`Upload delegation:\n${encodeDelegation(archiveBytes)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storacha/clawracha",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "OpenClaw plugin for Storacha workspace sync via UCN Pail",
5
5
  "type": "module",
6
6
  "files": [