Skip to content

Commit 12a4dfe

Browse files
committed
Fix package READMEs: dedupe, absolute links, prose, experimental pointers
- browser: the whole second half was a verbatim duplicate (a second copy of the source-runners block and the Host Interop section); delete it. - hyperon, das-client: relative `../pkg` links resolve wrong on npmjs.com; use the absolute GitHub URLs the other READMEs use. - edsl, das-client: rewrite the "Bold label. Explanation" list items as plain sentences. - core, hyperon: add a one-line pointer to the experimental streaming grounded-operation protocol, which was invisible from these pages.
1 parent c18f203 commit 12a4dfe

5 files changed

Lines changed: 13 additions & 56 deletions

File tree

packages/browser/README.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -74,53 +74,6 @@ await runner.dispose();
7474
See `examples/browser-interop` for a runnable smoke check and a bundle isolation
7575
check.
7676

77-
For embedders that already resolved imports, `@metta-ts/browser/source` exposes source runners:
78-
79-
```ts
80-
import { runSourceAsync } from "@metta-ts/browser/source";
81-
82-
const results = await runSourceAsync(`
83-
!(import! &self concurrency)
84-
!(par (+ 1 1) (+ 2 2))
85-
`);
86-
```
87-
88-
The async runner supports MeTTa's async forms (`par`, `race`, `with-mutex`) and uses Web Workers for
89-
`(once (hyperpose ...))` when the browser host provides them.
90-
91-
## Host Interop
92-
93-
`@metta-ts/browser/host` composes optional host runtimes such as Pyodide and
94-
SWI-Prolog WASM. The base browser package stays pure TypeScript. Import a host
95-
adapter only when the page needs it.
96-
97-
```ts
98-
import { createBrowserRunner, createBrowserTextLoader } from "@metta-ts/browser/host";
99-
import { createPyodideInterop } from "@metta-ts/py/pyodide";
100-
import { createSwiWasmInterop } from "@metta-ts/prolog/swi-wasm";
101-
102-
const files = new Map([
103-
["math.py", "def add(a, b):\n return a + b\n"],
104-
["facts.pl", "edge(alice, bob).\n"],
105-
]);
106-
const loadText = createBrowserTextLoader({ files, baseUrl: import.meta.url });
107-
const py = await createPyodideInterop({ loadText });
108-
const prolog = await createSwiWasmInterop({ loadText });
109-
const runner = createBrowserRunner({ files, interops: [py, prolog] });
110-
111-
const results = await runner.run(`
112-
!(import! &self "math.py")
113-
!(py-call (math.add 40 2))
114-
!(import! &self "facts.pl")
115-
!(prolog-call (edge alice $x))
116-
`);
117-
118-
await runner.dispose();
119-
```
120-
121-
See `examples/browser-interop` for a runnable smoke check and a bundle isolation
122-
check.
123-
12477
## License
12578

12679
[MIT](https://github.com/MesTTo/MeTTa-TS/blob/main/LICENSE).

packages/core/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ for (const { query, results: rs } of results) {
2828

2929
`runProgram` parses the source, adds every non-bang atom to the knowledge base, evaluates each `!`-query, and returns one result group per query. For a higher-level class API modeled on Python's `hyperon`, see [`@metta-ts/hyperon`](https://github.com/MesTTo/MeTTa-TS/tree/main/packages/hyperon).
3030

31+
The experimental line adds a pull-based streaming grounded-operation protocol on the `experimental` npm tag; see [Experimental features](https://mestto.github.io/MeTTa-TS/guide/experimental).
32+
3133
## License
3234

3335
[MIT](https://github.com/MesTTo/MeTTa-TS/blob/main/LICENSE).

packages/das-client/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @metta-ts/das-client
22

3-
A client for SingularityNET's Distributed AtomSpace (DAS). It lets a MeTTa TS program query a remote, shared atomspace over gRPC, and it presents that DAS as a `Space` backend, so a DAS drops in wherever an in-memory space would. It is Node-only, because a participant hosts an inbound bus node; from the browser you reach a DAS through [`@metta-ts/das-gateway`](../das-gateway).
3+
A client for SingularityNET's Distributed AtomSpace (DAS). It lets a MeTTa TS program query a remote, shared atomspace over gRPC, and it presents that DAS as a `Space` backend, so a DAS drops in wherever an in-memory space would. It is Node-only, because a participant hosts an inbound bus node; from the browser you reach a DAS through [`@metta-ts/das-gateway`](https://github.com/MesTTo/MeTTa-TS/tree/main/packages/das-gateway).
44

55
## Install
66

@@ -43,8 +43,8 @@ DAS_LIVE=1 pnpm vitest run packages/das-client/src/live-query.test.ts
4343

4444
Two things to know:
4545

46-
- **Query leaves are bare Symbols, not quoted strings.** `animals.metta` stores `is_animal`, `human`, etc. as Symbols, so build the pattern with `sym("is_animal")`, not `gstr("is_animal")` / `sym('"is_animal"')`. (An older das quoted string literals; that is gone.)
47-
- **Linux only: pin MongoDB to 7.0.** On Linux kernels >= 6.19, das-cli's default `mongodb-community-server:8.x` refuses to start (`ERROR: ... tcmalloc ... known issue with the v6.19 and newer Linux kernel`). Set `MONGODB_IMAGE_NAME = "mongo"` and `MONGODB_IMAGE_VERSION = "7.0"` in das-cli's `settings/config.py` so `db start` succeeds. Other platforms (and older kernels) run the 8.x default fine.
46+
- Query leaves are bare Symbols, not quoted strings. `animals.metta` stores `is_animal`, `human`, etc. as Symbols, so build the pattern with `sym("is_animal")`, not `gstr("is_animal")` / `sym('"is_animal"')`. (An older das quoted string literals; that is gone.)
47+
- On Linux with kernel >= 6.19, pin MongoDB to 7.0: das-cli's default `mongodb-community-server:8.x` refuses to start (`ERROR: ... tcmalloc ... known issue with the v6.19 and newer Linux kernel`). Set `MONGODB_IMAGE_NAME = "mongo"` and `MONGODB_IMAGE_VERSION = "7.0"` in das-cli's `settings/config.py` so `db start` succeeds. Other platforms (and older kernels) run the 8.x default fine.
4848

4949
A pattern with a variable then returns the matched bindings:
5050

packages/edsl/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ factorial(6); // 720
4242

4343
## The two term surfaces
4444

45-
- **Proxies + combinators.** `names()` and `vars()` mint names and variables (`const { parent, x } = ...`), and the capitalized combinators build the special forms: `If`, `Case`, `Let`, `LetStar`, `Match`, `Superpose`, `Collapse`, `Empty`, `Unify`, `Sealed`, `Quote`. Lowercase builders cover the grounded ops: `add`/`sub`/`mul`/`div`/`mod`, `eq`/`gt`/`lt`/`ge`/`le`, `and`/`or`/`not`, `carAtom`/`cdrAtom`/`consAtom`/`deconsAtom`, and `list`/`nil`/`e`. Builders compose, so nested patterns and repeated variables are just nested calls.
46-
- **The tagged template ``m`...` `` (and `mAll` for several atoms)** runs the real parser, so it expresses every MeTTa form, and `${value}` auto-grounds, which is the easiest way to drop a TS object in.
45+
- `names()` and `vars()` mint names and variables (`const { parent, x } = ...`), and the capitalized combinators build the special forms: `If`, `Case`, `Let`, `LetStar`, `Match`, `Superpose`, `Collapse`, `Empty`, `Unify`, `Sealed`, `Quote`. Lowercase builders cover the grounded ops: `add`/`sub`/`mul`/`div`/`mod`, `eq`/`gt`/`lt`/`ge`/`le`, `and`/`or`/`not`, `carAtom`/`cdrAtom`/`consAtom`/`deconsAtom`, and `list`/`nil`/`e`. Builders compose, so nested patterns and repeated variables are just nested calls.
46+
- The tagged template ``m`...` `` (and `mAll` for several atoms) runs the real parser, so it expresses every MeTTa form, and `${value}` auto-grounds, which is the easiest way to drop a TS object in.
4747

4848
## The runner and the host bridge
4949

5050
`mettaDB()` keeps MeTTa's two query mechanisms distinct: `query(pattern)` does `match &self` over stored atoms and returns binding rows (keys inferred from the pattern, or typed by an explicit `vars` map); `eval(atom)` (and `evalJs`, `evalAsync`, `evalJsAsync`) rewrites with the `=` rules and returns the nondeterministic results.
5151

5252
The host bridge runs both directions:
5353

54-
- **TypeScript into MeTTa (grounded functions).** `db.fn("name", fn)` registers a plain typed function with arguments auto-unwrapped to JS and the result auto-grounded; `db.fns({ ... })` registers several at once keyed by name; `db.asyncFn` awaits an async function. The raw `db.op`/`db.asyncOp` stay for full atom control (multiple results, custom matching).
55-
- **MeTTa into TypeScript (backward import).** `db.call.<name>(...)` builds and evaluates `(<name> ...args)` and returns every result unwrapped to JS; use bracket access for hyphenated names (`db.call["is-even"](4)`). `db.import("name")` returns a callable.
54+
- Grounded functions bridge TypeScript into MeTTa. `db.fn("name", fn)` registers a plain typed function with arguments auto-unwrapped to JS and the result auto-grounded; `db.fns({ ... })` registers several at once keyed by name; `db.asyncFn` awaits an async function. The raw `db.op`/`db.asyncOp` stay for full atom control (multiple results, custom matching).
55+
- A backward import bridges MeTTa into TypeScript. `db.call.<name>(...)` builds and evaluates `(<name> ...args)` and returns every result unwrapped to JS; use bracket access for hyphenated names (`db.call["is-even"](4)`). `db.import("name")` returns a callable.
5656

5757
### Typing the host bridge
5858

packages/hyperon/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A TypeScript class API for MeTTa atoms, spaces, and a runner, modeled on Hyperon's `hyperon.atoms`
44
and `hyperon.base`. Where the Python package wraps a Rust core over FFI, this one wraps the immutable
5-
terms of [`@metta-ts/core`](../core) in classes. It runs anywhere TypeScript runs, with no native
5+
terms of [`@metta-ts/core`](https://github.com/MesTTo/MeTTa-TS/tree/main/packages/core) in classes. It runs anywhere TypeScript runs, with no native
66
addon and no WASM.
77

88
Hyperon's Python method names are kept as aliases next to the idiomatic TypeScript ones, so code
@@ -60,7 +60,7 @@ sp.subst(E(S("parent"), S("tom"), V("c")), V("c"))
6060
.map((a) => a.toString()); // ["bob", "liz"]
6161
```
6262

63-
For a Distributed AtomSpace backend, see [`@metta-ts/das-client`](../das-client), whose `DasLiveSpace`
63+
For a Distributed AtomSpace backend, see [`@metta-ts/das-client`](https://github.com/MesTTo/MeTTa-TS/tree/main/packages/das-client), whose `DasLiveSpace`
6464
is the async analogue (a remote query is a network round-trip).
6565

6666
## Running MeTTa
@@ -94,6 +94,8 @@ m.run("!(double 21)")[0].map((a) => a.toString()); // ["42"]
9494
`registerToken(regex, constr)` registers a custom token, `space()` exposes the knowledge base, and
9595
`getAtomTypes(atom)` returns the types the runner infers for an atom.
9696

97+
An experimental pull-based variant, `registerStreamingOperation` (and its async twin), yields answers one at a time so a consumer such as `once` stops the producer rather than draining it. It ships on the `experimental` npm tag; see [Experimental features](https://mestto.github.io/MeTTa-TS/guide/experimental).
98+
9799
The runner's `space()` is live: an atom added through it reaches the evaluator
98100
exactly as a non-bang atom in `run` does, querying it sees what the evaluator sees, and removing an
99101
atom retracts it from evaluation.

0 commit comments

Comments
 (0)