@origintrail-official/dkg-adapter-openclaw 10.0.0 → 10.0.2

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/README.md CHANGED
@@ -43,12 +43,13 @@ openclaw gateway restart
43
43
 
44
44
  | Flag | Default | Purpose |
45
45
  | --- | --- | --- |
46
+ | `--network <name>` | `mainnet-gnosis` (fresh node) | Network to set up on (`mainnet-gnosis` \| `mainnet-base` \| `testnet`), persisted as `config.networkConfig`. Applies to a FRESH node only; an existing node keeps its current network (switch with `dkg init --network`). |
46
47
  | `--no-fund` | off | Skip the testnet faucet call during setup. Use this if your wallets are already funded, the faucet is unreachable, or you're running offline. |
47
48
  | `--no-start` | off | Skip starting the DKG daemon (configure only). |
48
49
  | `--no-verify` | off | Skip the post-setup verification pass. |
49
50
  | `--dry-run` | off | Preview the setup actions without writing anything. |
50
51
 
51
- Faucet funding is best-effort: a failed call logs a manual `curl` block and setup continues. See the main repo's [Testnet Funding](../../README.md#testnet-funding) section and [`docs/setup/TESTNET_FAUCET.md`](../../docs/setup/TESTNET_FAUCET.md) for request/response semantics, rate limits, and error codes.
52
+ Faucet funding only runs on testnet (mainnet networks have no faucet) and is best-effort: a failed call logs a manual `curl` block and setup continues. See the main repo's [Funding](../../README.md#funding) section and [`TESTNET_FAUCET.md`](../../docs/archive/internal/setup/TESTNET_FAUCET.md) for request/response semantics, rate limits, and error codes.
52
53
 
53
54
  ## Verification
54
55
 
@@ -408,9 +408,8 @@ export declare class DkgNodePlugin {
408
408
  * Register a context graph on-chain, tolerating the idempotent
409
409
  * "already registered" case (returns `undefined` so callers don't claim a
410
410
  * fresh registration). Any OTHER failure rethrows — the caller surfaces it as
411
- * a tool error and must NOT proceed. Shared by handleSharedMemoryPublish and
412
- * handleAssertionPublish (CONTRACT §G) so the register-then-publish logic
413
- * can't drift between the two publish tools.
411
+ * a tool error and must NOT proceed. Used by handleAssertionPublish (CONTRACT
412
+ * §G) for the register-then-publish path of the canonical per-KA publish tool.
414
413
  */
415
414
  private registerContextGraphIfNeeded;
416
415
  /**
@@ -448,7 +447,6 @@ export declare class DkgNodePlugin {
448
447
  */
449
448
  private handleMemorySearch;
450
449
  private handleListContextGraphs;
451
- private handlePublish;
452
450
  private handleQuery;
453
451
  private handleQueryCatalogList;
454
452
  private handleQueryCatalogRun;
@@ -489,7 +487,5 @@ export declare class DkgNodePlugin {
489
487
  private handleAssertionHistory;
490
488
  private handleSubGraphCreate;
491
489
  private handleSubGraphList;
492
- private handleSharedMemoryPublish;
493
- private handleShare;
494
490
  }
495
491
  //# sourceMappingURL=DkgNodePlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DkgNodePlugin.d.ts","sourceRoot":"","sources":["../src/DkgNodePlugin.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,YAAY,CAAC;AAiEpB,eAAO,MAAM,+BAA+B,QAEmC,CAAC;AAKhF,eAAO,MAAM,sCAAsC,QAGkC,CAAC;AAMtF,eAAO,MAAM,gCAAgC,QAG/B,CAAC;AAEf;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,GAAG,SAAS,CAKrB;AAwBD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAoB;IAKlC,OAAO,CAAC,OAAO,CAAU;IAGzB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,sBAAsB,CAAK;IACnC,OAAO,CAAC,SAAS,CAAyB;IAG1C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,8BAA8B,CAAuB;IAC7D,OAAO,CAAC,yBAAyB,CAAiC;IACl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;;;;;;OAMG;YACW,4BAA4B;IAmB1C;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAyChB,OAAO,CAAC,KAAK;YAmBC,YAAY;IAY1B;;;;;;;;;;;;;;;;;OAiBG;YACW,uBAAuB;IAkIrC;;;;OAIG;YACW,kBAAkB;YA2ElB,uBAAuB;YAcvB,WAAW;YAiJX,sBAAsB;YAgBtB,qBAAqB;YA4CrB,sBAAsB;YAiDtB,gBAAgB;YAYhB,iBAAiB;YASjB,kBAAkB;YAmBlB,iBAAiB;YAajB,wBAAwB;YA2FxB,wBAAwB;YA0BxB,oBAAoB;YAYpB,uBAAuB;YAYvB,qBAAqB;YAUrB,qBAAqB;YAUrB,wBAAwB;YAYxB,uBAAuB;YAYvB,eAAe;YAyBf,oBAAoB;IASlC;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;YAuIlB,qBAAqB;YA4FrB,oBAAoB;YA2BpB,uBAAuB;YAgDvB,sBAAsB;YAmEtB,sBAAsB;YAwGtB,uBAAuB;YAgCvB,sBAAsB;YAgBtB,yBAAyB;YA4CzB,oBAAoB;YAcpB,2BAA2B;YAoB3B,gCAAgC;YA+BhC,6BAA6B;YAiC7B,sBAAsB;YAkBtB,oBAAoB;YAapB,kBAAkB;CAUjC"}
@@ -15,7 +15,7 @@
15
15
  * (`POST /api/knowledge-assets` + `POST /api/knowledge-assets/:name/wm/write`),
16
16
  * which the agent reads from `GET /.well-known/skill.md` on startup.
17
17
  */
18
- import { GET_VIEWS, createDkgPublisherExtension, escapeDkgRdfLiteral, normalizeDkgPublisherQuads, resolveDkgHome, toEip55Checksum, validateAssertionName, } from '@origintrail-official/dkg-core';
18
+ import { GET_VIEWS, createDkgPublisherExtension, normalizeDkgPublisherQuads, resolveDkgHome, toEip55Checksum, validateAssertionName, } from '@origintrail-official/dkg-core';
19
19
  import { DkgDaemonClient, DkgDaemonHttpError, normalizeContextGraphId, } from './dkg-client.js';
20
20
  import { DkgChannelPlugin } from './DkgChannelPlugin.js';
21
21
  import { HookSurface } from './HookSurface.js';
@@ -2230,9 +2230,8 @@ export class DkgNodePlugin {
2230
2230
  * Register a context graph on-chain, tolerating the idempotent
2231
2231
  * "already registered" case (returns `undefined` so callers don't claim a
2232
2232
  * fresh registration). Any OTHER failure rethrows — the caller surfaces it as
2233
- * a tool error and must NOT proceed. Shared by handleSharedMemoryPublish and
2234
- * handleAssertionPublish (CONTRACT §G) so the register-then-publish logic
2235
- * can't drift between the two publish tools.
2233
+ * a tool error and must NOT proceed. Used by handleAssertionPublish (CONTRACT
2234
+ * §G) for the register-then-publish path of the canonical per-KA publish tool.
2236
2235
  */
2237
2236
  async registerContextGraphIfNeeded(contextGraphId, accessPolicy) {
2238
2237
  try {
@@ -2269,7 +2268,6 @@ export class DkgNodePlugin {
2269
2268
  handleJoinRequestApprove: this.handleJoinRequestApprove.bind(this),
2270
2269
  handleJoinRequestReject: this.handleJoinRequestReject.bind(this),
2271
2270
  handleSubscribe: this.handleSubscribe.bind(this),
2272
- handlePublish: this.handlePublish.bind(this),
2273
2271
  handleQuery: this.handleQuery.bind(this),
2274
2272
  handleQueryCatalogList: this.handleQueryCatalogList.bind(this),
2275
2273
  handleQueryCatalogRun: this.handleQueryCatalogRun.bind(this),
@@ -2293,8 +2291,6 @@ export class DkgNodePlugin {
2293
2291
  handleAssertionHistory: this.handleAssertionHistory.bind(this),
2294
2292
  handleSubGraphCreate: this.handleSubGraphCreate.bind(this),
2295
2293
  handleSubGraphList: this.handleSubGraphList.bind(this),
2296
- handleSharedMemoryPublish: this.handleSharedMemoryPublish.bind(this),
2297
- handleShare: this.handleShare.bind(this),
2298
2294
  handleMemorySearch: this.handleMemorySearch.bind(this),
2299
2295
  };
2300
2296
  }
@@ -2556,73 +2552,6 @@ export class DkgNodePlugin {
2556
2552
  return this.daemonError(err);
2557
2553
  }
2558
2554
  }
2559
- async handlePublish(args) {
2560
- try {
2561
- const contextGraphId = typeof args.context_graph_id === 'string' ? args.context_graph_id.trim() : '';
2562
- if (!contextGraphId) {
2563
- return this.error('"context_graph_id" is required.');
2564
- }
2565
- const rawQuads = args.quads;
2566
- if (!Array.isArray(rawQuads) || rawQuads.length === 0) {
2567
- return this.error('"quads" must be a non-empty array of {subject, predicate, object} objects.');
2568
- }
2569
- if (args.register_if_needed !== undefined && typeof args.register_if_needed !== 'boolean') {
2570
- return this.error('"register_if_needed" must be a boolean.');
2571
- }
2572
- const registerIfNeeded = args.register_if_needed === true;
2573
- if (args.access_policy !== undefined && args.access_policy !== 0 && args.access_policy !== 1) {
2574
- return this.error('"access_policy" must be 0 (open) or 1 (private).');
2575
- }
2576
- // FIX S: `access_policy` only applies when registering the CG — reject it
2577
- // (rather than silently drop the privacy setting) when register_if_needed
2578
- // is not true.
2579
- if (args.access_policy !== undefined && !registerIfNeeded) {
2580
- return this.error('"access_policy" requires "register_if_needed": true — it only applies when registering the context graph.');
2581
- }
2582
- // CONTRACT §G: publishing requires the CG to be registered on-chain and the
2583
- // daemon does NOT auto-register. When `register_if_needed` is true, register
2584
- // first (idempotent — "already registered" is success) via the shared helper;
2585
- // a hard registration failure is a tool error and we do NOT publish. When
2586
- // false/omitted, publish directly and surface the daemon's not-registered
2587
- // error verbatim.
2588
- const registration = registerIfNeeded
2589
- ? await this.registerContextGraphIfNeeded(contextGraphId, args.access_policy)
2590
- : undefined;
2591
- const result = await this.publisher.publishVerifiableMemory({ contextGraphId, quads: rawQuads });
2592
- const summary = {
2593
- kaId: result.kaId,
2594
- kaCount: result.kas?.length ?? 0,
2595
- quadsPublished: rawQuads.length,
2596
- };
2597
- if (result.ual !== undefined)
2598
- summary.ual = result.ual;
2599
- if (registration)
2600
- summary.registration = registration;
2601
- // Direct publish can return HTTP 207 with
2602
- // `contextGraphError` set when the KA minted on-chain but the context-graph
2603
- // binding FAILED. `this.post` treats 207 as success, so
2604
- // without this the partial reads as clean success. The UAL/kaId are valid and
2605
- // the asset IS published on-chain — surface a PARTIAL/warning. The agent must
2606
- // NOT re-run dkg_publish: each call mints a FRESH assertion, so a retry would
2607
- // DUPLICATE the already-published asset and still not re-bind the CG. The
2608
- // CG-binding retry is an operator/daemon concern.
2609
- const contextGraphError = result.contextGraphError;
2610
- if (typeof contextGraphError === 'string' && contextGraphError.length > 0) {
2611
- return this.json({
2612
- ...summary,
2613
- partial: true,
2614
- warning: 'Partial publish: the asset IS published on-chain (the UAL/kaId are valid and final) — only the ' +
2615
- `context-graph binding failed (${contextGraphError}). Do NOT re-run dkg_publish: it would mint a ` +
2616
- 'DUPLICATE asset and still not re-bind the context graph. Surface this to the operator to ' +
2617
- 're-attempt the context-graph binding.',
2618
- });
2619
- }
2620
- return this.json(summary);
2621
- }
2622
- catch (err) {
2623
- return this.daemonError(err);
2624
- }
2625
- }
2626
2555
  async handleQuery(args) {
2627
2556
  try {
2628
2557
  const sparql = String(args.sparql);
@@ -3275,10 +3204,65 @@ export class DkgNodePlugin {
3275
3204
  return this.error(`"name" is invalid: ${nameValidation.reason}`);
3276
3205
  }
3277
3206
  const subGraphName = args.sub_graph_name ? String(args.sub_graph_name) : undefined;
3278
- // Create stays on the legacy assertion route: it preserves the
3279
- // `{ assertionUri, alreadyExists }` contract and name validation that the
3280
- // KA create route (an idempotent get-or-create) can't yet provide. Only
3281
- // the WM/SWM mutation verbs (write / promote / discard) move to KA.
3207
+ // [D3] One-shot path: when `quads` are supplied, create → write → seal in a
3208
+ // single call via the combined KA route, optionally sharing to SWM. Stops at
3209
+ // a sealed WM draft by default; `also_share_swm:true` lands a publish-ready KA
3210
+ // in SWM. This NEVER mints to VM — there is no `alsoPublishVm` here (publish is
3211
+ // the separate dkg_knowledge_asset_publish step).
3212
+ // Validate also_share_swm's shape uniformly (parity with MCP + Hermes) — even on the
3213
+ // bare-create path where it is IGNORED — since the shared tool schema advertises a
3214
+ // boolean. Done BEFORE the quads branch so the runtime contract is consistent.
3215
+ if (args.also_share_swm !== undefined && typeof args.also_share_swm !== 'boolean') {
3216
+ return this.error('"also_share_swm" must be a boolean.');
3217
+ }
3218
+ const rawQuads = args.quads;
3219
+ if (rawQuads !== undefined) {
3220
+ if (!Array.isArray(rawQuads) || rawQuads.length === 0) {
3221
+ return this.error('"quads" must be a non-empty array of {subject, predicate, object} objects.');
3222
+ }
3223
+ // Default FALSE, passed EXPLICITLY so the createKnowledgeAsset client helper's
3224
+ // internal seal-true default (dkg-client.ts) cannot leak and silently auto-share.
3225
+ const alsoShareSwm = args.also_share_swm === true;
3226
+ // Strip surrounding <…> on subject/predicate/object before normalizing (parity
3227
+ // with the MCP + Hermes create one-shots) so a bracketed URI stays a URI rather
3228
+ // than being quoted as a literal. Then auto-type objects + pin the per-KA `graph`
3229
+ // via normalizeDkgPublisherQuads, so a one-shot create lands identical triples
3230
+ // across all three adapters.
3231
+ const stripBrackets = (t) => typeof t === 'string' && t.length >= 2 && t.startsWith('<') && t.endsWith('>')
3232
+ ? t.slice(1, -1)
3233
+ : t;
3234
+ const strippedQuads = rawQuads.map((q) => ({
3235
+ ...q,
3236
+ subject: stripBrackets(q.subject),
3237
+ predicate: stripBrackets(q.predicate),
3238
+ object: stripBrackets(q.object),
3239
+ }));
3240
+ const quads = normalizeDkgPublisherQuads(strippedQuads);
3241
+ const result = await this.client.createKnowledgeAsset(contextGraphId, name, {
3242
+ subGraphName,
3243
+ quads,
3244
+ alsoShareSwm,
3245
+ });
3246
+ // The daemon returns 207 + errors:[{phase:'swm-share'}] when create+seal lands
3247
+ // but the opt-in SWM share fails; the client treats 207 as success. Judge from
3248
+ // the OUTCOME, not the requested flag, so agents don't publish an asset that
3249
+ // never reached SWM (parity with the MCP adapter's 207 handling).
3250
+ const r = result;
3251
+ const resultErrors = Array.isArray(r.errors)
3252
+ ? r.errors
3253
+ : [];
3254
+ const shareError = resultErrors.find((e) => e?.phase === 'swm-share');
3255
+ if (alsoShareSwm && (shareError || r.publishReady === false)) {
3256
+ return this.error(`Created and sealed knowledge asset "${name}" in "${contextGraphId}", but the opt-in ` +
3257
+ `Shared Working Memory share FAILED${shareError?.error ? `: ${shareError.error}` : ''}. ` +
3258
+ `The asset did NOT reach Shared Working Memory and is NOT publish-ready — do not publish yet; ` +
3259
+ `retry the share with dkg_knowledge_asset_share, then publish.`);
3260
+ }
3261
+ return this.json(result);
3262
+ }
3263
+ // No quads → the unchanged bare create. Stays on the legacy assertion route: it
3264
+ // preserves the `{ assertionUri, alreadyExists }` contract and name validation
3265
+ // that the KA create route (an idempotent get-or-create) can't yet provide.
3282
3266
  const result = await this.publisher.createLocalWorkspace({
3283
3267
  contextGraphId,
3284
3268
  assertionName: name,
@@ -3471,8 +3455,8 @@ export class DkgNodePlugin {
3471
3455
  // CONTRACT §D: `clear_shared_memory_after` is NOT exposed on the per-asset
3472
3456
  // publish tool — on vm/publish it is graph-wide destructive (wipes every
3473
3457
  // other agent's unpublished SWM in the CG/sub-graph). The this-asset SWM
3474
- // cleanup runs unconditionally regardless. The CG-wide clear stays on
3475
- // dkg_publish / dkg_shared_memory_publish.
3458
+ // cleanup runs unconditionally regardless; there is no agent-facing CG-wide
3459
+ // SWM clear (the legacy bridge tools that carried it were removed in #1087).
3476
3460
  if (args.register_if_needed !== undefined && typeof args.register_if_needed !== 'boolean') {
3477
3461
  return this.error('"register_if_needed" must be a boolean.');
3478
3462
  }
@@ -3490,9 +3474,9 @@ export class DkgNodePlugin {
3490
3474
  // (#1116) at gas/TRAC cost regardless of `register_if_needed`. When
3491
3475
  // `register_if_needed` is true we run an EXPLICIT register first (idempotent —
3492
3476
  // "already registered" is success) so the caller can choose the registration's
3493
- // access_policy, mirroring dkg_shared_memory_publish. A hard registration
3494
- // failure is a tool error: do NOT publish. When false/omitted, publish
3495
- // directly — the daemon auto-registers and defaults the policy.
3477
+ // access_policy. A hard registration failure is a tool error: do NOT publish.
3478
+ // When false/omitted, publish directly — the daemon auto-registers and defaults
3479
+ // the policy.
3496
3480
  const registration = registerIfNeeded
3497
3481
  ? await this.registerContextGraphIfNeeded(contextGraphId, args.access_policy)
3498
3482
  : undefined;
@@ -3784,140 +3768,5 @@ export class DkgNodePlugin {
3784
3768
  return this.daemonError(err);
3785
3769
  }
3786
3770
  }
3787
- async handleSharedMemoryPublish(args) {
3788
- try {
3789
- const contextGraphId = String(args.context_graph_id ?? '').trim();
3790
- if (!contextGraphId)
3791
- return this.error('"context_graph_id" is required.');
3792
- // Mirror handleAssertionPromote's `entities` validation shape: omit → daemon-side default
3793
- // (selection="all"), explicit array → must be non-empty and all strings. No other values
3794
- // allowed; a bogus scalar would silently 400 at the daemon.
3795
- const raw = args.root_entities;
3796
- let rootEntities;
3797
- if (raw === undefined || raw === null) {
3798
- rootEntities = undefined;
3799
- }
3800
- else if (Array.isArray(raw) && raw.length > 0 && raw.every((e) => typeof e === 'string')) {
3801
- rootEntities = raw.map((e) => String(e));
3802
- }
3803
- else {
3804
- return this.error('"root_entities" must be omitted or a non-empty array of root entity URIs.');
3805
- }
3806
- const subGraphName = args.sub_graph_name ? String(args.sub_graph_name) : undefined;
3807
- const registerIfNeeded = args.register_if_needed === true;
3808
- if (args.register_if_needed !== undefined && typeof args.register_if_needed !== 'boolean') {
3809
- return this.error('"register_if_needed" must be a boolean.');
3810
- }
3811
- if (args.reveal_on_chain !== undefined && typeof args.reveal_on_chain !== 'boolean') {
3812
- return this.error('"reveal_on_chain" must be a boolean.');
3813
- }
3814
- if (args.access_policy !== undefined && args.access_policy !== 0 && args.access_policy !== 1) {
3815
- return this.error('"access_policy" must be 0 (open) or 1 (private).');
3816
- }
3817
- // FIX S: `access_policy` only applies when registering the CG — reject it
3818
- // (rather than silently drop the privacy setting) when register_if_needed
3819
- // is not true.
3820
- if (args.access_policy !== undefined && !registerIfNeeded) {
3821
- return this.error('"access_policy" requires "register_if_needed": true — it only applies when registering the context graph.');
3822
- }
3823
- const registration = registerIfNeeded
3824
- ? await this.registerContextGraphIfNeeded(contextGraphId, args.access_policy)
3825
- : undefined;
3826
- const result = await this.publisher.publishSharedMemory({ contextGraphId, rootEntities, subGraphName });
3827
- return this.json(registration ? { ...result, registration } : result);
3828
- }
3829
- catch (err) {
3830
- return this.daemonError(err);
3831
- }
3832
- }
3833
- async handleShare(args) {
3834
- try {
3835
- // Type-validate at the runtime boundary. Without this, a malformed MCP
3836
- // call passing `content: {}` or `false` would coerce via String(...) to
3837
- // `"[object Object]"` / `"false"` and pollute SWM with garbage. Reject
3838
- // up front instead.
3839
- if (args.content !== undefined && typeof args.content !== 'string') {
3840
- return this.error('"content" must be a string.');
3841
- }
3842
- if (args.context_graph_id !== undefined && typeof args.context_graph_id !== 'string') {
3843
- return this.error('"context_graph_id" must be a string.');
3844
- }
3845
- if (args.sub_graph_name !== undefined &&
3846
- args.sub_graph_name !== null &&
3847
- typeof args.sub_graph_name !== 'string') {
3848
- return this.error('"sub_graph_name" must be a string.');
3849
- }
3850
- // Use the raw content for serialization so leading/trailing whitespace
3851
- // and terminal newlines are preserved verbatim — agents sharing code
3852
- // snippets or exact transcripts depend on this. Validate against the
3853
- // trimmed form so a whitespace-only payload still rejects as "empty".
3854
- const content = args.content ?? '';
3855
- const contextGraphId = (args.context_graph_id ?? '').trim();
3856
- if (!content.trim())
3857
- return this.error('"content" is required.');
3858
- if (!contextGraphId)
3859
- return this.error('"context_graph_id" is required.');
3860
- const rawSub = args.sub_graph_name;
3861
- const subGraphName = rawSub === undefined || rawSub === null
3862
- ? undefined
3863
- : (rawSub.trim() || undefined);
3864
- // Best-effort node-identity attribution. Try the gated probes first
3865
- // (these warm the cache when the memory resolver API is attached),
3866
- // then fall back to a direct /api/agent/identity probe so dkg_share
3867
- // works in `memory.enabled: false` configurations too. If neither
3868
- // path resolves, we still mint a unique-per-call subject under an
3869
- // `anon` namespace — the share itself doesn't require identity
3870
- // (the daemon's /api/shared-memory/write doesn't), so refusing to
3871
- // write would over-couple the tool to a startup race.
3872
- await Promise.all([this.ensureNodeAgentAddress(), this.ensureNodePeerId()]);
3873
- let addr = this.resolveDefaultAgentAddress();
3874
- if (!addr) {
3875
- const probe = await this.client.getAgentIdentity().catch(() => null);
3876
- if (probe?.ok && probe.identity) {
3877
- if (probe.identity.agentAddress)
3878
- this.nodeAgentAddress = probe.identity.agentAddress;
3879
- if (probe.identity.peerId)
3880
- this.nodePeerId = probe.identity.peerId;
3881
- addr = this.resolveDefaultAgentAddress();
3882
- }
3883
- }
3884
- // Unique per call — the publisher's delete-then-insert upsert
3885
- // (dkg-publisher.ts:422-429) keys off the root entity, so a stable
3886
- // subject would replace the prior share. Random shareId guarantees
3887
- // a fresh root every time, regardless of attribution.
3888
- const shareId = `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
3889
- const subject = addr
3890
- ? `urn:openclaw:${addr}:shared:${shareId}`
3891
- : `urn:openclaw:anon:shared:${shareId}`;
3892
- // Serialize content as an N-Triples literal. The canonical
3893
- // escapeDkgRdfLiteral from @origintrail-official/dkg-core handles
3894
- // the ECHAR set (\\, ", \n, \r, \t, \f, \b), but leaves other ASCII
3895
- // control bytes (0x00-0x07, 0x0B, 0x0E-0x1F, 0x7F) raw — those
3896
- // would still produce an invalid N-Triples literal. Defensive
3897
- // post-pass UCHAR-encodes the remaining bytes. (A canonical fix
3898
- // belongs in the core helper itself; tracked separately.)
3899
- const escaped = escapeDkgRdfLiteral(content).replace(new RegExp('[' +
3900
- String.fromCharCode(0x00) + '-' + String.fromCharCode(0x1F) +
3901
- String.fromCharCode(0x7F) +
3902
- ']', 'g'), (ch) => '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0').toUpperCase());
3903
- const literal = `"${escaped}"`;
3904
- const quads = [{
3905
- subject,
3906
- predicate: 'urn:openclaw:sharedContent',
3907
- object: literal,
3908
- }];
3909
- const result = await this.client.share(contextGraphId, quads, { subGraphName });
3910
- // Surface the minted subject so callers can target THIS share in a
3911
- // follow-up `dkg_shared_memory_publish({ root_entities: [...] })` or
3912
- // inspect it precisely. Field name is snake_case to match the
3913
- // consuming tool's argument shape — agents chaining `dkg_share` →
3914
- // `dkg_shared_memory_publish` can pass the value through without
3915
- // case translation.
3916
- return this.json({ ...result, subject, root_entities: [subject] });
3917
- }
3918
- catch (err) {
3919
- return this.daemonError(err);
3920
- }
3921
- }
3922
3771
  }
3923
3772
  //# sourceMappingURL=DkgNodePlugin.js.map