Updates to MD
This commit is contained in:
@@ -22,7 +22,7 @@ This tree follows the **agent** Markdown workspace convention: “soul” files
|
||||
3. During a session, the model loads the full document with the **`read_skill`** tool (do not paste huge skills into the user channel unless asked).
|
||||
4. Shared skills can live under **`~/.agent/skills/`**; keep **`workspace/skills/`** for machine-local or repo-specific behavior.
|
||||
|
||||
Seeded examples in this repo (under **`skills/`**): **`p2p-os-status`**, **`bare-os-kernel-proc`**, **`bare-os-super-developer`**, **`holesail`** (managed **`state.json`**, **`seed`**/`**key`**, stock **`bare-www-*`** / **`bare-ssh-*`**), and **`hdms`** (Hyperdrive mounts and invite/pair).
|
||||
Seeded examples in this repo (under **`skills/`**): **`p2p-os-status`**, **`bare-os-kernel-proc`**, **`bare-os-super-developer`**, **`holesail`** (managed **`state.json`**, **`seed`**/**`key`**, stock **`bare-www-*`** / **`bare-ssh-*`**), and **`hdms`** (Hyperdrive mounts and invite/pair).
|
||||
|
||||
After **`agent --config`** / **`--setup`** (or changing **`owner_name`** / **`agent_label`** via **`edit_agent_config`**), **`IDENTITY.md`** and **`USER.md`** are regenerated from **`config.json`** so the workspace matches the operator and agent label.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Use when the user asks what kernel features are **on or off in this session**, w
|
||||
|
||||
1. Call **`read_proc_file`** on **`/proc/bare_os/features`** or **`/proc/bare_os/features.json`** (same payload shape as documented in the static system prompt).
|
||||
2. Call **`read_proc_file`** on **`/proc/bare_os/capabilities.json`** for structured capability bits.
|
||||
3. Optionally read **`/proc/bare_os/metrics_live.json`** or related **`/proc/bare_os/*`** paths if the question is about live metrics (stay within tool allowlists).
|
||||
3. Optionally read **`/proc/bare_os/metrics_live.json`** or related `**/proc/bare_os/*`** paths if the question is about live metrics (stay within tool allowlists).
|
||||
4. Use **`get_system_info`** with **`want: capabilities`** or **`want: swarm`** only as a convenience when you already need bundled blobs; prefer **`read_proc_file`** for “what is enabled **now**?”.
|
||||
|
||||
## Output format
|
||||
|
||||
@@ -16,13 +16,13 @@ Use this skill when you (or the user) need to **author or debug** Bare OS **Java
|
||||
|
||||
1. **Entrypoints** — Kernel: **`async function start(ctx)`** in `/boot/init.js` (or your image). Commands: **`async function run(ctx, argv)`** where **`argv[0]`** is the invoked name (e.g. `agent`). You **must** set **`ctx.exitCode`** (number) before returning on failure paths.
|
||||
2. **`ctx` is not Node** — There is no full **`process`**, no **`require('node:fs')`**. The booter assembles **`ctx`** as the narrow **syscall surface**: **`vfs`**, **`env`**, **`execLine`**, **`runBinCommand`**, optional **`httpFetch`**, **`bare`**, identity helpers, diagnostics, etc. See the mermaid overview in Chapter 2 of the developer guide.
|
||||
3. **`/bin/agent` is special** — The agent bundle uses **`run_js_script`** for guest JS and a frozen tool surface; do not assume **`node`** exists. For **general** in-guest scripting, prefer **`ctx.vfs`** + **`ctx.execLine`** / **`ctx.runBinCommand`** and optional **`ctx.bare.*`** modules when enabled.
|
||||
3. **`/bin/agent` is special** — The agent bundle uses **`run_js_script`** for guest JS and a frozen tool surface; do not assume **`node`** exists. For **general** in-guest scripting, prefer **`ctx.vfs`** + **`ctx.execLine`** / **`ctx.runBinCommand`** and optional `**ctx.bare.*`** modules when enabled.
|
||||
|
||||
## Writing scripts (`run(ctx, argv)`)
|
||||
|
||||
- **Argv** — `argv` is a string array; **`argv[0]`** is how you were invoked (symlink name matters for multi-call binaries).
|
||||
- **Stdout** — Prefer **`ctx.console.log`** / **`ctx.console.error`** (session-aware). For binary or captured stdout, **`ctx.bareOsBinWrite`** may exist when the shell captures pipeline output.
|
||||
- **Shell a subprocess** — **`await ctx.execLine('some shell line', { signal, timeoutMs })`** returns a string (see booter **`raceWithAbortAndTimeout`**). Heavy work: **`await ctx.runBinCommand(['/bin/grep', …], opts)`** for same resolution as the interactive shell.
|
||||
- **Shell a subprocess** — **`await ctx.execLine('some shell line', { signal, timeoutMs })`** returns a string (see booter **`raceWithAbortAndTimeout`**). Heavy work: `**await ctx.runBinCommand(['/bin/grep', …], opts)`** for same resolution as the interactive shell.
|
||||
- **Filesystem** — **`await ctx.vfs.readFile(path)`** → **`Uint8Array`**; **`await ctx.vfs.writeFile(path, buf, opts?)`**. Decode with **`ctx.b4a.toString(buf)`** or **`TextDecoder`**. Always use **absolute** paths under **`/home`**, **`/tmp`**, **`/mnt`**, **`/bin`**, etc., per policy.
|
||||
- **Environment** — **`ctx.env`** is mutable shell state (also **`ctx.vfs.env`**). After **`execLine`**, **`ctx.env.BARE_OS_EXIT_STATUS`** reflects last exit code when the booter sets it.
|
||||
- **Exit** — Set **`ctx.exitCode = 1`** (or other code) on error; **`0`** on success. **`ctx.requestBooterExit(code)`** ends the whole session from builtins like **`exit`**.
|
||||
@@ -35,10 +35,10 @@ Think in layers the stock OS already uses:
|
||||
| --- | --- | --- |
|
||||
| **Init** | **`bareOsRegisterBootStepHook`**, initd units | Boot-order DAG (stock: **`bare-os-www`** before **`bare-holesail`** so **`bare-www-*`** reaches loopback HTTP; **`bare-openssh`** + login stack ensure **`bare-ssh-*`** in **`~/.holesail/state.json`**); pair **`registerKernelShutdownHook`** / initd disposers for teardown. |
|
||||
| **Virtual files** | **`bareOsRegisterVirtualFile(name, reader, opts?)`** | Serves **`/run/bare-os/virtual/<name>`**; gated by runtime caps. |
|
||||
| **IPC** | **`ctx.bareOsIpc`** when present | `**push`/`take**`, JSON helpers, fanout, duplex bridge — bounded; audit when **`BARE_OS_IPC_AUDIT=1`**. |
|
||||
| **IPC** | **`ctx.bareOsIpc`** when present | `**push`/`take**`, JSON helpers, fanout, duplex bridge — bounded; audit when `**BARE_OS_IPC_AUDIT=1`**. |
|
||||
| **Kernel extensions** | **`bareOsRegisterKernelExtensionRecord`**, **`bareOsRunImageScript`** under **`/lib/bare-os/extensions/`** | Trusted image paths only. |
|
||||
| **Sandboxed user JS** | **`bareOsSandboxRunScript(source, argv?, opts?)`** | Restricted **`ctx`**; disable with **`BARE_OS_SANDBOX_SCRIPT=0`**. |
|
||||
| **Pear / host** | **`bareOsPearIpcEmit`**, **`bareOsPearIpcRequest`**, mirror/export hints | Host must cooperate; return **`{ ok, hint }`** patterns. |
|
||||
| **Sandboxed user JS** | **`bareOsSandboxRunScript(source, argv?, opts?)`** | Restricted **`ctx`**; disable with `**BARE_OS_SANDBOX_SCRIPT=0`**. |
|
||||
| **Pear / host** | **`bareOsPearIpcEmit`**, **`bareOsPearIpcRequest`**, mirror/export hints | Host must cooperate; return `**{ ok, hint }`** patterns. |
|
||||
|
||||
Before touching sensitive **`ctx`** methods in hardened images, call **`ctx.bareOsIsCtxMethodAllowed?.(name)`** when boot policy **`BARE_OS_BOOT_POLICY_ALLOWED_CTX_METHODS`** is set.
|
||||
|
||||
@@ -61,7 +61,7 @@ Before touching sensitive **`ctx`** methods in hardened images, call **`ctx.bare
|
||||
### Bare OS introspection & policy
|
||||
|
||||
- **`ctx.bareOsCtxApiVersion`**, **`ctx.bareOsRuntimeCaps`** (frozen)
|
||||
- **`ctx.bareOsAdvertisedKernelCapabilityWords`**, **`ctx.bareOsSeedKernelCapabilityWords`** — **`>>> 0`** when testing bits.
|
||||
- **`ctx.bareOsAdvertisedKernelCapabilityWords`**, **`ctx.bareOsSeedKernelCapabilityWords`** — `**>>> 0`** when testing bits.
|
||||
- **`ctx.bareOsGetResourceStatus`**, **`ctx.bareOsReadProcMetricsLive`**, **`ctx.bareOsReadBareTopSnapshot`**
|
||||
- **`ctx.bareOsRegisterVirtualFile`**, **`ctx.bareOsInvalidateVirtualFile`**, **`ctx.bareOsUpdateVirtualFileMeta`**
|
||||
- **`ctx.bareOsEmitIpcAudit`**, **`ctx.bareOsEvaluatePeerAdmission`**, **`ctx.bareOsEmitMirrorDriveHint`**
|
||||
@@ -70,7 +70,7 @@ Before touching sensitive **`ctx`** methods in hardened images, call **`ctx.bare
|
||||
|
||||
- **`ctx.httpFetch`** — Same allow/deny policy as **`curl`** / **`wget`**; every host for **`web_fetch`** must be allowlisted.
|
||||
- **`ctx.bare`** — Frozen map of vendored modules (**`b4a`**, **`protomux`**, …) when **`BARE_OS_BARE_MODULES`** allows.
|
||||
- **`ctx.bareOsHostStats`**, **`ctx.bareOsChat*`**, **`ctx.bareOsPearIpc*`** — Present only when wired by the booter/host.
|
||||
- **`ctx.bareOsHostStats`**, `**ctx.bareOsChat***`, `**ctx.bareOsPearIpc*`** — Present only when wired by the booter/host.
|
||||
|
||||
For the **full** list and semantics, open **`developer-guide/02-the-context-object.md`** in the repo (or **`read_file`** on a mounted checkout).
|
||||
|
||||
@@ -107,7 +107,7 @@ Save under **`/home/.../my-tool.mjs`** and run by **absolute path** (or register
|
||||
|
||||
## Agent-specific note
|
||||
|
||||
When helping **inside `/bin/agent`**, the model uses **tools** (`read_file`, `run_js_script`, …) backed by the **same** personal/system VFS as the rest of the guest. **`run_js_script`** writes a temp **`.mjs`** under **`~/.agent/`** and executes it like a **`/bin`** script — the script body should use the same **`ctx`** patterns above when the harness passes **`ctx`**.
|
||||
When helping **inside `/bin/agent`**, the model uses **tools** (`read_file`, `run_js_script`, …) backed by the **same** personal/system VFS as the rest of the guest. **`run_js_script`** writes a temp **`.mjs`** under **`~/.agent/**` and executes it like a **`/bin`** script — the script body should use the same **`ctx`** patterns above when the harness passes **`ctx`**.
|
||||
|
||||
## Checklist before shipping
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ requires: [read_man_page, read_file, vfs]
|
||||
|
||||
## When to use
|
||||
|
||||
Use when the user asks about **HDMS** (Hyperdrive Management): **`hdms`** CLI, **`/.bare/hdms/registry.json`**, **`/mnt/<label>`** mounts, **invite/pair** sharing, **`ctx.runHdms`**, **`ctx.bareOsSubscribeHdmsLifecycle`**, or how HDMS relates to **`login`** / guest mode.
|
||||
Use when the user asks about **HDMS** (Hyperdrive Management): **`hdms`** CLI, **`/.bare/hdms/registry.json`**, `**/mnt/<label>**` mounts, **invite/pair** sharing, **`ctx.runHdms`**, **`ctx.bareOsSubscribeHdmsLifecycle`**, or how HDMS relates to **`login`** / guest mode.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **HDMS activates after identity unlock.** Guest sessions can **list** mounts that are already open; **mutating** commands (**`create`**, **`add`**, registry edits, **`invite`**, **`pair`**, etc.) go through **`assertLoggedIn`**: require **`ctx.identity.state === 'unlocked'`** and an active HDMS controller.
|
||||
- **HDMS activates after identity unlock.** Guest sessions can **list** mounts that are already open; **mutating** commands (**`create`**, **`add`**, registry edits, **`invite`**, **`pair`**, etc.) go through **`assertLoggedIn`**: require `**ctx.identity.state === 'unlocked'`** and an active HDMS controller.
|
||||
- Implementation: **`packages/bare-os-booter/lib/hdms-manager.js`** (**`runHdmsCli`**, **`HdmsController`**), exposed as **`ctx.runHdms(argv)`** in **`packages/bare-os-booter/index.js`**.
|
||||
|
||||
## Registry and VFS
|
||||
|
||||
@@ -16,12 +16,12 @@ Use when the user asks about **Holesail** in this repo: exposing TCP/UDP through
|
||||
|
||||
1. **Integration** lives in **`packages/bare-os-booter/lib/bare-holesail.js`** (initd + optional early “kernel-path” instance), **`bare-holesail-managed.js`** ( **`state.json`** rows, **`ensure`**, **`SyncPersistedServerKey`** ), **`holesail-cli.js`** (**`ctx.bareOsRunHolesailCli`** for **`/bin/holesail`**), **`bare-os-www-holesail.js`**, **`bare-os-ssh-holesail.js`**.
|
||||
2. **Resolution order** under **`pear run`**: the booter prefers **`ctx.bare.holesail`** ( **`/lib/bare/bundles/holesail.js`** after drive merge), else host **`import.meta.resolve('holesail')`**, else eval of the drive IIFE bundle via **`ctx.vfs`** — **`/bin`** and **`/boot/init.js`** are **not** Node modules, so scripts must not **`require('holesail')`**.
|
||||
3. **Stock default**: initd unit **`bare-holesail`** is **on** when **`BARE_OS_HOLESAIL_INITD`** and **`BARE_OS_HOLESAIL_MANAGED`** are left at defaults (**`1`** in stock **`shellEnv`** unless the host clears them). Disable with **`BARE_OS_HOLESAIL_INITD=0`** or **`systemctl disable bare-holesail`** (**`~/.config/bare-os/initd/disabled.txt`**).
|
||||
3. **Stock default**: initd unit **`bare-holesail`** is **on** when **`BARE_OS_HOLESAIL_INITD`** and **`BARE_OS_HOLESAIL_MANAGED`** are left at defaults (**`1`** in stock **`shellEnv`** unless the host clears them). Disable with **`BARE_OS_HOLESAIL_INITD=0`** or **`systemctl disable bare-holesail`** (`**~/.config/bare-os/initd/disabled.txt`**).
|
||||
4. **Stock auto-rows** — **`bare-www-<port>`** after **`bare-os-www`** listens (**`BARE_OS_WWW_HOLESAIL=0`** disables merge). **`bare-ssh-<port>`** after **`bare-openssh`** listens (**`BARE_OS_SSH_HOLESAIL=0`** disables). **`bare-user-session-stack`** re-ensures SSH tunnel after **`bare-holesail`** starts if sshd was already listening.
|
||||
|
||||
## Managed state (`state.json`)
|
||||
|
||||
- **Default path** — **`BARE_OS_HOLESAIL_STATE`** unset → **`~/.holesail/state.json`** (logical, under **`$HOME`**). Override env for a different logical path.
|
||||
- **Default path** — **`BARE_OS_HOLESAIL_STATE`** unset → `**~/.holesail/state.json**` (logical, under `**$HOME`**). Override env for a different logical path.
|
||||
- **Legacy merge** — If the primary file is empty/missing: **`/.bare/holesail/state.json`**, **`/.bare/holesail/guest/state.json`**, **`/home/guest/.holesail/state.json`** are merged once.
|
||||
- **`seed`** — Stable ctor secret: **64-char hex**, or valid **z32** suffix (migrated from legacy **`hs://…`**-only rows). Never replace **`seed`** with only the URL suffix written as ctor input.
|
||||
- **`key`** — Full shareable **`hs://…`** URL; written/updated after **`ready()`** (**`bareHolesailManagedSyncPersistedServerKey`**). **`holesail list`** shows live URL when tunnel runs.
|
||||
@@ -41,7 +41,7 @@ Separate from initd: enable with **`BARE_OS_HOLESAIL_KERNEL=1`** and the **`BARE
|
||||
From **`holesail-cli.js`** help text:
|
||||
|
||||
- **`holesail add ID --server|--client`** with optional **`--key`**, bare **`hs://…`** token (no **`--key`** prefix), **`--port`**, **`--host`**, **`--udp`**, `**--secure` / `--no-secure**`, **`--log`**.
|
||||
- **`holesail remove ID`**, **`start|stop|restart ID`**, **`enable|disable ID`**.
|
||||
- **`holesail remove ID`**, `**start|stop|restart ID**`, `**enable|disable ID`**.
|
||||
|
||||
Managed **`bare-holesail`** starts after **`kernel-logger`** and **`bare-os-www`** by default. Logs: **`/var/log/bare-os/holesail.log`**. Example unit drop-in: **`/etc/bare-os/units/bare-holesail.unit.example`**.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Use this skill whenever the user asks for system status, peer count, drive healt
|
||||
|
||||
1. Use **`list_directory`** / **`read_file`** on relevant **`/home/...`** paths (personal vs system) when the question is about files on Hyperdrive.
|
||||
2. Call **`get_swarm_peers`** (and **`get_system_info`** as needed) for swarm / session context when exposed by the booter.
|
||||
3. Use **`read_proc_file`** on **`/proc/bare_os/*`** mirrors when the user cares about kernel/session metrics (see the **bare-os-kernel-proc** skill for feature/capability JSON).
|
||||
3. Use **`read_proc_file`** on `**/proc/bare_os/*`** mirrors when the user cares about kernel/session metrics (see the **bare-os-kernel-proc** skill for feature/capability JSON).
|
||||
4. Check SSH/kernel narrative only when **`read_proc_file`** or **`read_man_page`** confirms how this image exposes **`sshd`** (do not assume **`node`** exists).
|
||||
5. When a **personal static site** matters, after **`login`** check **`~/.www`** (and optional **`curl -I http://127.0.0.1:8088/`**, or the port from **`BARE_OS_WWW_PORT`** in env); initd logs append to **`/var/log/bare-os/www.log`**.
|
||||
6. Summarize in clear bullet points:
|
||||
|
||||
Reference in New Issue
Block a user