Files
marqdo/examples/agent-sandbox-okf/index.mq.md

3.3 KiB

markup, title, description, import
markup title description import
occlusion agent-sandbox-okf — trial then commit O1 example: opt-in sandbox trial with GFM-table returns and link-index reads.
agent fs
ext/ai/agent.mq.md lib/fs.mq.md

main

返回 类型 说明
result any None; execute this page's documented steps in order and observe their output or stated effects

The two trials intentionally differ only in commit. First inspect a successful dry trial and verify that note.txt has not appeared in the host directory. Then run the committed trial, read the host file and compare its actual content. This separates an observed proposal from an observed filesystem change; neither ok alone nor a proposed path establishes that a commit happened.

Use a disposable filesystem root: the example replaces its named _example_sbx directory and leaves the committed evidence there for inspection. It does not promise to roll back a committed external effect. Read the returned profile as part of the trial evidence, and keep failures visible rather than manufacturing a success marker when the expected file is absent.

Short demo: write via agent.trial, prove the host is clean until commit.

We first had = Compute had for the next step.

  1. had We now [Call fs.remove](> fs.remove path="_example_sbx").

We first _ = 0 for the next step.

We now [Call fs.make dir](> fs.make_dir path="_example_sbx").

We first dry = [Compute dry](agent.trial(root="_example_sbx", write_path="note.txt", text="sandbox-okf", commit=False)) for the next step. We first dry_ok = ok) for the next step. We first dry_committed = committed) for the next step.

  1. dry_ok
  2. not dry_committed We now [Display this step's result](> print text="dry-ok").
We now **[Display this step's result](> print text="dry-bad-commit")**.

We now [Display this step's result](> print text="dry-fail").

We first leaked = Compute leaked for the next step.

  1. leaked We now [Display this step's result](> print text="host-leaked").

We now [Display this step's result](> print text="host-clean").

We first wet = [Compute wet](agent.trial(root="_example_sbx", write_path="note.txt", text="sandbox-okf", commit=True)) for the next step. We first wet_ok = ok) for the next step. We first wet_committed = committed) for the next step.

  1. wet_ok
  2. wet_committed We now [Display this step's result](> print text="wet-ok").
We now **[Display this step's result](> print text="wet-no-commit")**.

We now [Display this step's result](> print text="wet-fail").

We first body = Compute body for the next step.

  1. body == "sandbox-okf" We now [Display this step's result](> print text="proof-visible").

We now [Display this step's result](> print text="proof-missing").

We first pname = name), "name")) for the next step.

  1. pname == "default" We now [Display this step's result](> print text="profile-default").

We now [Display this step's result](> print text="profile-other").