Memory port from
@obversa/api when a job needs files it can open again in a later run; the
runtime accepts any adapter that implements it. For what memory is for,
read Memory; for the adapters that ship,
Memory adapters.
The port has a scope and one execute method that takes a command. The
smallest use creates a file and reads it back:
examples/memory-simple.ts (excerpt)
/memories. A result has ok: true and a typed
value, or ok: false and a typed error with the command, the error code and
a message; some errors also carry the path and structured details. Every
adapter uses the same error codes, and a conformance kit checks the
contract without a network service. A command needs:
command, one of the six below.path, under/memories, oroldPathandnewPathforrename.- The command’s own fields:
text,viewRange,oldTextandnewText, orinsertLine.
Run a command
Set storage limits
@obversa/memory-simple and @obversa/memory-git use these defaults:
- One file can contain 65,536 bytes.
- One scope can contain 1,048,576 bytes and 256 files.
- File types:
.txt,.md,.json,.py,.yamland.yml.
Name a path
A path can contain letters, numbers, periods, underscores and hyphens. Each segment can contain 128 characters, and a complete path 1,024 bytes. A scope and all written text must be complete Unicode: the adapters reject malformed Unicode instead of replacing incomplete characters. The memory root can’t be a file, and you can’t delete or rename it.Failure
Next steps
- Memory adapters: the in-process store, the Git
store, and how to pass one to
run(). - Memory mechanics:
ground,curateandconsolidateover the port. - API: the
Memorycontract and the conformance kit.