|
|
преди 21 часа | |
|---|---|---|
| .. | ||
| cmd | преди 1 ден | |
| icons | преди 1 ден | |
| pages | преди 21 часа | |
| playground | преди 21 часа | |
| reference | преди 21 часа | |
| samples | преди 21 часа | |
| static | преди 21 часа | |
| templates | преди 1 ден | |
| README.md | преди 1 ден | |
| content.go | преди 1 ден | |
| go.mod | преди 1 ден | |
| go.sum | преди 1 ден | |
| main.go | преди 1 ден | |
| main_test.go | преди 1 ден | |
| markdown.go | преди 1 ден | |
| reference.go | преди 1 ден | |
| render.go | преди 21 часа | |
| toolchain.go | преди 1 ден | |
This folder builds the AGI documentation site (reference, guides and a
browser playground) into docs/agi/. That folder is
gitignored and built locally: nothing here changes the published
os.aroz.org site or its links. The HTML is generated; edit the sources here
and run the generator, never the files in docs/agi/.
cd scripts/agidocgen
go run . # build docs/agi, including the playground engine (WebAssembly)
go run . -serve :8132 # build, then serve it at http://localhost:8132/agi/
go run . -nowasm # skip the WebAssembly build (the playground then shows an error)
go test ./... # generator tests, engine tests, and every sample run through the engine
The agi-docs entry in .claude/launch.json
runs the -serve form. The server only serves files: after editing a source,
run go run . again and reload the page.
It is its own Go module (imuslab.com/arozos/agidocgen), so it never touches
the ArozOS build in src/. Dependencies: github.com/robertkrimen/otto
(MIT, the same interpreter ArozOS uses), github.com/yuin/goldmark (MIT),
and their indirect golang.org/x/text (BSD-3) and gopkg.in/sourcemap.v1
(BSD-2).
| Source | What it gives the site |
|---|---|
src/web/Terminal/docs/api.json |
The function list of every library: names, signatures, return types, one-line descriptions and examples. The same file is the Terminal app's in-app help, so the two never disagree |
src/mod/agi/agi.go |
The runtime version (AgiVersion) shown in the header |
pages/*.md |
Guides (introduction, paths, libraries, runtime, ...). Front matter: title, summary, order |
reference/<library>.md |
The long-form text of each library page, seeded from src/mod/agi/README.md. A heading that starts with a backticked signature (## `filelib.readFile(vpath)` → `string`) becomes a function card and is paired with its api.json entry |
samples/NN-<id>.agi |
Playground samples (see below) |
templates/, static/, icons/ |
Page templates, styles and scripts, and the inline SVG icons (the sitegen icons are reused too) |
A library page lists every api.json function of its section. Functions that have a heading in the Markdown get its text; the rest are placed after their api.json neighbour with the api.json description. Every build prints a drift report: functions documented in Markdown but missing from api.json (so the Terminal's help lacks them), api.json functions without a heading, and pages or sections that exist on one side only. Fix drift by adding the missing entries to api.json (one object per library section, see the maintainer note in the AGI README) or a heading to the reference page.
playground.html runs AGI scripts in the browser with the real Otto
interpreter, compiled to WebAssembly.
| Path | Role |
|---|---|
playground/ |
The engine (package playground): a fresh VM per run, the AGI globals and functions, an in-memory drive with user:/, tmp:/ and web:/, and the libraries. Pure Go, tested natively |
cmd/agiwasm/ |
The WebAssembly entry point (GOOS=js GOARCH=wasm); exposes agiPlayground.run/wsPush/wsClose/defaults |
static/playground/worker.js |
Loads agi.wasm in a Web Worker. Stopping a run terminates the worker and starts a new one |
static/assets/playground.js |
The page: file tree, editor, output, tool windows, samples. The workspace (files, request, mocks, stored state) is kept in IndexedDB |
How the engine matches ArozOS:
web:/ (the
WebApp folder) it runs like /system/ajgi/interface: POST fields become
globals, a JSON body also sets POST_data, and includes() / execd()
resolve against the script's folder. On user:/ or tmp:/ it runs like a
serverless endpoint with REQ_METHOD, getPara, postPara and readBody,
and relative paths start at the script's folder.filelib,
imagelib (JPEG, PNG, GIF), ziplib (zip, tar, tar.gz, gz; not 7z),
appdata, share, notification, scheduler, websocket and delay.
The database, shares, scheduled tasks, accounts and llm usage outlive a run
(the page sends them with every run), as they would on a server.http (rules by method and URL),
llm (fixed, echo or rules; streaming chunks), cnn (one JSON envelope per
function), sqlite and sysinfo (Services window), and every other library
in api.json (git, email, office, ...), whose functions return the JSON
set in the Services window. Every mocked call is listed in the output's
Services tab with the rule that answered it.render.go (playModes) decides the "Runs in the playground" or "Mocked in
the playground" pill of each reference page; keep it in step with
playground.NativeLibs (a test checks this).Each samples/NN-<id>.agi starts with a header; NN- only orders the menu:
/*---
title: Call a web API
group: Services
summary: http.get and http.request answered by the rules in the HTTP window.
path: web:/Playground/http-mock.agi
setup: {"request":{...},"mocks":{"http":{"rules":[...]}},"files":[{"path":"user:/a.txt","text":"..."}]}
---*/
path defaults to web:/Playground/<id>.agi. setup is one line of JSON:
request (method, form, json, query), user, mocks (same shape as
the engine's Mocks) and files to create when missing. TestSamplesRun
runs every sample against the page's starting drive, so a sample that breaks
fails go test.