@origintrail-official/dkg-adapter-openclaw 10.0.13 → 10.0.15

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.
@@ -448,6 +448,7 @@ export declare class DkgNodePlugin {
448
448
  private handleMemorySearch;
449
449
  private handleListContextGraphs;
450
450
  private handleQuery;
451
+ private resolveQueryAgentAddress;
451
452
  private handleQueryCatalogList;
452
453
  private handleQueryCatalogRun;
453
454
  private handleQueryCatalogSave;
@@ -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;AAgEpB,eAAO,MAAM,+BAA+B,QAE6C,CAAC;AAG1F,eAAO,MAAM,sCAAsC,QAEiD,CAAC;AAGrG,eAAO,MAAM,gCAAgC,QAEgB,CAAC;AAE9D,eAAO,MAAM,6BAA6B,QAEI,CAAC;AAE/C;;;;;;;GAOG;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;IAClE,OAAO,CAAC,wBAAwB,CAAS;IACzC,OAAO,CAAC,sBAAs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C,QAAQ;IAyChB,OAAO,CAAC,KAAK;YAmBC,YAAY;IAY1B;;;;;;;;;;;;;;;;;OAiBG;YACW,uBAAuB;IAkIrC;;;;OAIG;YACW,kBAAkB;YA2ElB,uBAAuB;YAcvB,WAAW;YA8FX,wBAAwB;YAyCxB,sBAAsB;YAgBtB,qBAAqB;YA4DrB,sBAAsB;YA8DtB,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;YAuCvB,sBAAsB;YAyCtB,sBAAsB;YAwGtB,uBAAuB;YAgCvB,sBAAsB;YAgBtB,yBAAyB;YA4CzB,oBAAoB;YAcpB,2BAA2B;YAoB3B,gCAAgC;YA+BhC,6BAA6B;YAiC7B,sBAAsB;YAkBtB,oBAAoB;YAapB,kBAAkB;CAUjC"}
@@ -26,6 +26,7 @@ import { join } from 'node:path';
26
26
  import { canonicalPathForCompare, defaultStateDirForWorkspace, legacyStateDirForWorkspace, workspaceDirForDefaultStateDir, } from './state-dir-path.js';
27
27
  import { mergeAdapterPluginConfigs } from './openclaw-config.js';
28
28
  import { CONTEXT_GRAPH_QUERY_SUBGRAPH, USER_QUERY_CATALOG_SLUG, USER_QUERY_CATALOG_NAME, USER_QUERY_CATALOG_DESCRIPTION, buildQueryCatalogSaveWrite, filterContextGraphsForScope, normalizeQueryCatalogItems, normalizeSemanticEnrichmentQuads, optionalString, queryCatalogSlug, readOnlySparqlOperation, } from './dkg-node-plugin-query-catalog.js';
29
+ import { prepareQueryCatalogExecution } from '@origintrail-official/dkg-core/query-catalog';
29
30
  import { channelConfigFingerprint, extractUserTextFromContent, formatRecalledMemoryBlock, inferContentTypeFromExtension, isValidEthAddressString, pickShareableMultiaddr, slugify, } from './dkg-node-plugin-helpers.js';
30
31
  import { AUTO_RECALL_QUERY_MAX_CHARS, AVAILABLE_CONTEXT_GRAPH_CACHE_TTL_MS, DEFAULT_DAEMON_URL, LOCAL_AGENT_STATE_RETRY_BASE_DELAY_MS, LOCAL_AGENT_STATE_RETRY_MAX_DELAY_MS, NODE_PEER_ID_DEFERRED_RETRY_DELAY_MS, OPENCLAW_LOCAL_AGENT_CAPABILITIES, OPENCLAW_LOCAL_AGENT_MANIFEST, STATE_DIR_SOURCE_PRIORITY, } from './dkg-node-plugin-constants.js';
31
32
  import { buildNodeTools } from './tools/node-tools.js';
@@ -2619,58 +2620,10 @@ export class DkgNodePlugin {
2619
2620
  // cross-agent WM read with a malformed value would otherwise get the
2620
2621
  // node's own WM back — wrong namespace, wrong data, no error.
2621
2622
  // `undefined` (field genuinely absent) still takes the default.
2622
- if (args.agent_address !== undefined) {
2623
- if (typeof args.agent_address !== 'string') {
2624
- return this.error('"agent_address" must be a string.');
2625
- }
2626
- if (args.agent_address.trim() === '') {
2627
- return this.error('"agent_address" must be a non-empty string.');
2628
- }
2629
- }
2630
- let agentAddress = typeof args.agent_address === 'string'
2631
- ? args.agent_address.trim()
2632
- : undefined;
2633
- if (view === 'working-memory' && agentAddress === undefined) {
2634
- // Mirror the daemon's writer-side `defaultAgentAddress ?? peerId`
2635
- // priority. First try the identity endpoint; if it has not resolved
2636
- // yet, ensure the peerId fallback has had a chance to populate.
2637
- if (this.nodeAgentAddress === undefined) {
2638
- await this.ensureNodeAgentAddress().catch(() => { });
2639
- }
2640
- agentAddress = this.resolveDefaultAgentAddress();
2641
- if (agentAddress === undefined) {
2642
- await this.ensureNodePeerId().catch(() => { });
2643
- agentAddress = this.resolveDefaultAgentAddress();
2644
- }
2645
- if (agentAddress === undefined) {
2646
- return this.error('"view: working-memory" requires an agent identity. Supply `agent_address` explicitly, ' +
2647
- "or retry once the node's agent address or peer ID is available.");
2648
- }
2649
- }
2650
- if (view === 'working-memory' && agentAddress !== undefined) {
2651
- // T48/T53 — `toAgentPeerId` strips the legacy `did:dkg:agent:`
2652
- // prefix (raw eth and raw peerId are pass-through). The daemon's
2653
- // own contract (`packages/agent/src/dkg-agent.ts:2647-2696`)
2654
- // accepts BOTH self-aliases for the default agent: when the
2655
- // keystore is present, writes go to `defaultAgentAddress` (eth)
2656
- // and reads must use eth; on fresh/auth-disabled/no-keystore
2657
- // nodes, the daemon's writer-side resolves to `peerId` and reads
2658
- // must use peerId. Don't hard-reject non-eth values — that
2659
- // would break legitimate WM reads on no-keystore nodes.
2660
- const stripped = toAgentPeerId(agentAddress);
2661
- // T65 — If the post-strip value is eth-shaped, normalize to
2662
- // EIP-55 checksum form. The daemon stores chat-turn graph URIs
2663
- // under `agent.defaultAgentAddress` which ethers `verifyWallet
2664
- // .address` produces in EIP-55 form, and SPARQL graph URIs are
2665
- // case-sensitive. A caller-supplied lowercase wallet address
2666
- // would otherwise miss the daemon's checksum-case URI prefix
2667
- // and silently return zero bindings even when data exists.
2668
- // Non-eth-shaped values (peerIds, anything else) pass through
2669
- // verbatim — daemon contract still accepts them as self-aliases.
2670
- agentAddress = isValidEthAddressString(stripped)
2671
- ? toEip55Checksum(stripped)
2672
- : stripped;
2673
- }
2623
+ const resolvedAgentAddress = await this.resolveQueryAgentAddress(args.agent_address, view);
2624
+ if (resolvedAgentAddress.error)
2625
+ return resolvedAgentAddress.error;
2626
+ const agentAddress = resolvedAgentAddress.value;
2674
2627
  const result = await this.client.query(sparql, {
2675
2628
  contextGraphId,
2676
2629
  view,
@@ -2682,6 +2635,40 @@ export class DkgNodePlugin {
2682
2635
  return this.daemonError(err);
2683
2636
  }
2684
2637
  }
2638
+ async resolveQueryAgentAddress(rawAgentAddress, view) {
2639
+ if (rawAgentAddress !== undefined && typeof rawAgentAddress !== 'string') {
2640
+ return { error: this.error('"agent_address" must be a string.') };
2641
+ }
2642
+ if (typeof rawAgentAddress === 'string' && rawAgentAddress.trim() === '') {
2643
+ return { error: this.error('"agent_address" must be a non-empty string.') };
2644
+ }
2645
+ let agentAddress = typeof rawAgentAddress === 'string'
2646
+ ? rawAgentAddress.trim()
2647
+ : undefined;
2648
+ if (view === 'working-memory' && agentAddress === undefined) {
2649
+ if (this.nodeAgentAddress === undefined) {
2650
+ await this.ensureNodeAgentAddress().catch(() => { });
2651
+ }
2652
+ agentAddress = this.resolveDefaultAgentAddress();
2653
+ if (agentAddress === undefined) {
2654
+ await this.ensureNodePeerId().catch(() => { });
2655
+ agentAddress = this.resolveDefaultAgentAddress();
2656
+ }
2657
+ if (agentAddress === undefined) {
2658
+ return {
2659
+ error: this.error('"view: working-memory" requires an agent identity. Supply `agent_address` explicitly, ' +
2660
+ "or retry once the node's agent address or peer ID is available."),
2661
+ };
2662
+ }
2663
+ }
2664
+ if (view === 'working-memory' && agentAddress !== undefined) {
2665
+ const stripped = toAgentPeerId(agentAddress);
2666
+ agentAddress = isValidEthAddressString(stripped)
2667
+ ? toEip55Checksum(stripped)
2668
+ : stripped;
2669
+ }
2670
+ return { value: agentAddress };
2671
+ }
2685
2672
  async handleQueryCatalogList(args) {
2686
2673
  try {
2687
2674
  const contextGraphId = normalizeContextGraphId(String(args.context_graph_id ?? ''));
@@ -2721,10 +2708,21 @@ export class DkgNodePlugin {
2721
2708
  return this.error(`Saved query selector is ambiguous: ${selector}. Matching slugs: ${matches.map((item) => item.slug).join(', ')}`);
2722
2709
  }
2723
2710
  const savedQuery = matches[0];
2724
- const queryOpts = savedQuery.subGraph && savedQuery.subGraph !== CONTEXT_GRAPH_QUERY_SUBGRAPH
2725
- ? { contextGraphId, subGraphName: savedQuery.subGraph }
2726
- : { contextGraphId };
2727
- const result = await this.client.query(savedQuery.sparql, queryOpts);
2711
+ const rawParameters = args.parameters;
2712
+ if (rawParameters !== undefined && (!rawParameters || typeof rawParameters !== 'object' || Array.isArray(rawParameters))) {
2713
+ return this.error('"parameters" must be an object keyed by saved-query parameter name.');
2714
+ }
2715
+ const execution = prepareQueryCatalogExecution(savedQuery, (rawParameters ?? {}));
2716
+ const resolvedAgentAddress = await this.resolveQueryAgentAddress(args.agent_address, execution.view);
2717
+ if (resolvedAgentAddress.error)
2718
+ return resolvedAgentAddress.error;
2719
+ const queryOpts = {
2720
+ contextGraphId,
2721
+ ...(execution.subGraphName ? { subGraphName: execution.subGraphName } : {}),
2722
+ ...(execution.view ? { view: execution.view } : {}),
2723
+ ...(resolvedAgentAddress.value ? { agentAddress: resolvedAgentAddress.value } : {}),
2724
+ };
2725
+ const result = await this.client.query(execution.sparql, queryOpts);
2728
2726
  return this.json({
2729
2727
  contextGraphId,
2730
2728
  savedQuery,
@@ -2757,6 +2755,17 @@ export class DkgNodePlugin {
2757
2755
  const catalogName = optionalString(args.catalog_name) ?? USER_QUERY_CATALOG_NAME;
2758
2756
  const catalogDescription = optionalString(args.catalog_description) ?? USER_QUERY_CATALOG_DESCRIPTION;
2759
2757
  const resultColumn = optionalString(args.result_column)?.replace(/^\?/, '');
2758
+ let requestedView;
2759
+ if (args.execution_view !== undefined) {
2760
+ if (typeof args.execution_view !== 'string') {
2761
+ return this.error('"execution_view" must be working-memory, shared-working-memory, or verifiable-memory.');
2762
+ }
2763
+ const normalizedView = args.execution_view.trim();
2764
+ if (!GET_VIEWS.includes(normalizedView)) {
2765
+ return this.error('"execution_view" must be working-memory, shared-working-memory, or verifiable-memory.');
2766
+ }
2767
+ requestedView = normalizedView;
2768
+ }
2760
2769
  const rank = Date.now();
2761
2770
  const { savedQuery, quads } = buildQueryCatalogSaveWrite({
2762
2771
  contextGraphId,
@@ -2770,6 +2779,8 @@ export class DkgNodePlugin {
2770
2779
  resultColumn,
2771
2780
  rank,
2772
2781
  catalogRank: 50,
2782
+ parameters: args.parameters,
2783
+ view: requestedView,
2773
2784
  });
2774
2785
  const write = await this.client.writeQueryCatalog(contextGraphId, quads);
2775
2786
  return this.json({