Expand description
The authoring interface a coding harness uses to build a session spec.
A harness (a coding agent, an IDE, a CLI wizard) edits agent.json on the
user’s behalf. These operations tell it what can be written, what is wrong
with the document, and which decisions are still the user’s to make:
cataloglists the vocabulary: voices, guard atoms, policies, tool bindings, resume policies, question rules and diagnostic codes.checkvalidates a document and reports structuredDiagnostics. Each has a JSON pointer and, where the repair is mechanical, aFixexpressed as JSON-patch operations.planlists the open decisions asQuestions. Every option carries the patch that records it.answerapplies chosen options. It plans again before each answer, so every patch is computed against the current document.apply_patchapplies JSON-patch operations (RFC 6902add,replace,remove) atomically.
All of them take the document as a JSON value, so a document that does not deserialize still gets diagnostics.
Fixes in one CheckReport are each computed against the checked
document. Apply one, then check again: two fixes from the same report can
touch the same array.
use gemini_adk_fluent_rs::spec::authoring::{self, Answer, Decisions};
use serde_json::json;
let doc = json!({ "name": "", "instruction": "Answer questions about opening hours." });
let plan = authoring::plan(&doc, &Decisions::new());
assert_eq!(plan.questions[0].id, "name");
let answered = authoring::answer(
&doc,
&[Answer::with_value("name", json!("hours-line"))],
&Decisions::new(),
)
.unwrap();
assert_eq!(answered.spec["name"], "hours-line");Structs§
- Answer
- One answer to a
Question. - Answer
Option - One way to answer a question.
- Answered
- The result of
answer. - Catalog
- The vocabulary a harness may write. The full document shape is the spec’s
JSON Schema (
SessionSpec::json_schema,adk spec schema). - Catalog
Entry - One authorable item: its name, what it means and an example.
- Check
Report - The result of
check. - Diagnostic
- One problem found by
check. - Fix
- A mechanical repair for a diagnostic.
- Patch
Error - Why a patch could not be applied.
- Plan
- The result of
plan. - Question
- A decision the document leaves open.
Enums§
- Answer
Error - Why answers could not be applied. Nothing is applied when any answer fails.
- PatchOp
- One JSON-patch operation (RFC 6902 subset).
pathis a JSON pointer. - Question
Kind - How a question is answered.
- Severity
- How serious a diagnostic is.
Constants§
- ANSWER_
PLACEHOLDER - The placeholder an option’s patch uses for the user’s value. A string
equal to it is replaced by
Answer::value. - AUTHORING_
VERSION - Version of the authoring interface. Bumped when an operation’s output changes incompatibly.
- SIGNALS_
EXTRACTOR - Name of the extractor that question and fix patches add boolean caller signals to (confirmations, intents).
Functions§
- answer
- Apply
answersin order. Before each one the document is planned again, so a patch never comes from a stale plan. - apply_
patch - Apply
opsin order to a copy ofdoc. Either every operation applies or the document is returned unchanged inside the error. - catalog
- The authoring vocabulary.
- check
- Validate
docand report structured diagnostics. - check_
str checkthe text of a spec file. Text that is not JSON gets aninvalid_jsondiagnostic with its line and column.- plan
- The open decisions in
doc, skipping question ids indecisions.
Type Aliases§
- Decisions
- Answered question ids, mapped to the chosen option value. A harness stores this next to the spec and passes it back so answered questions are not asked again.