Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

@mettascript/das-gateway

A transport-agnostic gateway that bridges MeTTaScript to a SingularityNET Distributed AtomSpace (DAS). It encodes a pattern query, sends it over an injected transport (Connect/HTTP, usable from the browser), and decodes the bindings back into MeTTa atoms.

Install

npm install @mettascript/das-gateway

Usage

import { queryDas, type GatewayTransport } from "@mettascript/das-gateway";
import { parse, standardTokenizer } from "@mettascript/core";

// You provide the transport (e.g. a Connect client). The gateway is browser-reachable over HTTP.
const transport: GatewayTransport = {
  /* query(request) => Promise<QueryResponse> */
};

const pattern = parse("(Parent $x Bob)", standardTokenizer())!;
const bindings = await queryDas(transport, "&self", pattern);

Querying a DAS involves network I/O, so the gateway's query API is async. Pair it with the async evaluation path in @mettascript/core to call it from MeTTa source.

Each returned binding value must contain exactly one MeTTa atom. decodeBindings throws a deterministic error for blank, malformed, bang-prefixed, or multi-atom values instead of returning a partial binding.

License

MIT.