@yaag/extension 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/cli.md CHANGED
@@ -40,6 +40,9 @@ Warning: describe imports the module and executes its top level. Keep program mo
40
40
  A bad invocation prints this usage text on stderr and exits with code 2. Those
41
41
  argv errors have no troubleshooting entry: the usage text is the fix.
42
42
 
43
+ The `--config` and `--no-config` flags select the config layers of a Run. See
44
+ [Configuration](configuration.md#locations).
45
+
43
46
  ## Tools
44
47
 
45
48
  ### yaag_run
@@ -52,7 +55,7 @@ Runs an Orchestration Program. It maps to `yaag run`.
52
55
  | `script` | `--eval-fd` | Inline source. It can import `@yaag/runtime` and `typebox` only. |
53
56
  | `args` | `--args <json>` | A JSON object string. |
54
57
  | `background` | none | Extension only. Starts the Run and returns its Run id. |
55
- | `record` | `--record <file>` | Writes the Cassette here. |
58
+ | `record` | `--record <file>` | Writes the Cassette here. yaag makes a missing directory of this path, and stops the Run at the start when it cannot. |
56
59
  | `resume` | `--resume <file>` | Replays matching Asks, then continues live. |
57
60
  | `config` | `--config <file>` | Reads one more config file for this Run. |
58
61
  | `noConfig` | `--no-config` | Ignores the global config and the project config. |
@@ -0,0 +1,87 @@
1
+ # Configuration
2
+
3
+ yaag reads up to three config files at the start of a Run. Their merged
4
+ content is the configuration of that Run. yaag reads them one time, at Run
5
+ start. A config edit during a Run changes nothing until the next Run.
6
+
7
+ ## Locations
8
+
9
+ | Layer | Location |
10
+ |---|---|
11
+ | Global | `$YAAG_CONFIG_DIR/config.json` when `YAAG_CONFIG_DIR` is set. Else `$XDG_CONFIG_HOME/yaag/config.json` when `XDG_CONFIG_HOME` is an absolute path. Else `~/.config/yaag/config.json`. |
12
+ | Project | `.yaag/config.json` in the Program Directory of the Run. |
13
+ | Run | The file that `yaag run --config <file>` or the `config` option of the `yaag_run` tool gives. Give it one time only. |
14
+
15
+ The Program Directory is the nearest directory that contains `.yaag/`. yaag
16
+ searches upward from the directory of the program file. For an Inline Program,
17
+ the search starts in the working directory.
18
+
19
+ A global or project file that does not exist is an empty layer. A `--config`
20
+ file that does not exist stops the Run at the start.
21
+
22
+ ## Supported fields
23
+
24
+ A config file is plain JSON. [`examples/config.json`](examples/config.json)
25
+ shows the full surface:
26
+
27
+ <!-- embed: docs/examples/config.json -->
28
+
29
+ ```json
30
+ {
31
+ "agents": {
32
+ "extensions": ["./extensions/team-conventions.ts", "npm:@acme/pi-guardrails"]
33
+ }
34
+ }
35
+ ```
36
+
37
+ | Field | Type | Effect |
38
+ |---|---|---|
39
+ | `agents.extensions` | array of strings | Extensions that every Agent of the Run loads, as extra `pi -e` arguments. |
40
+
41
+ An entry is an extension path or an `npm:`/`git:` specifier. A relative path
42
+ resolves against the directory of the config file that declares it. An `npm:`
43
+ or `git:` specifier installs from the Agent working directory.
44
+
45
+ Validation is strict. An unknown key, or a value with a wrong type, stops the
46
+ Run at the start.
47
+
48
+ ## How the layers merge
49
+
50
+ The extension lists concatenate in this order: global, then project, then run,
51
+ then the `extensions` of the spawn call itself. yaag removes duplicates by
52
+ resolved path. The first occurrence keeps its place. The merged list loads on
53
+ top of the extensions a spawn call declares — a config never removes one.
54
+
55
+ ## Opt out
56
+
57
+ `--no-config` (CLI) or `noConfig: true` (tool) makes the Run ignore the global
58
+ config and the project config. It does not ignore an explicit `--config` file.
59
+ Thus `--no-config --config ./one.json` gives the Run one known config file.
60
+
61
+ `configExtensions: false` on one spawn call or one Agent Definition opts that
62
+ one Agent out. The Agent then loads only the extensions its own call declares:
63
+
64
+ <!-- embed: @yaag/runtime/src/types.ts -->
65
+
66
+ ```ts
67
+ /**
68
+ * Load the Effective Config's `agents.extensions` for this Agent. Default
69
+ * true; false spawns with only the extensions this call declares (ADR-0040).
70
+ */
71
+ readonly configExtensions?: boolean;
72
+ ```
73
+
74
+ ## Errors
75
+
76
+ A config file that yaag cannot read or parse, or that fails validation, stops
77
+ the Run at the start with exit code 1. The message names the file. See
78
+ [A config file is missing or invalid](troubleshooting.md#a-config-file-is-missing-or-invalid).
79
+
80
+ ## Record and resume
81
+
82
+ The Run record stores the `--config` path, never the file content. A
83
+ `yaag_run` call that gives `resume` alone reads the stored path again, and
84
+ yaag reads every layer again at that moment. An extension list that changed
85
+ since the recording is a Divergence at the first spawn it changes: a strict
86
+ replay stops there, and a resume goes live there. See
87
+ [Replay or resume mismatch](troubleshooting.md#replay-or-resume-mismatch).
@@ -0,0 +1,5 @@
1
+ {
2
+ "agents": {
3
+ "extensions": ["./extensions/team-conventions.ts", "npm:@acme/pi-guardrails"]
4
+ }
5
+ }
@@ -50,4 +50,5 @@ argument schema of the program.
50
50
  - [Authoring](authoring.md) — how to write a program.
51
51
  - [Examples](examples.md) — five programs, from minimal to record and resume.
52
52
  - [CLI reference](cli.md) — every flag and every tool parameter.
53
+ - [Configuration](configuration.md#locations) — the three config files a Run reads.
53
54
  - [Troubleshooting](troubleshooting.md) — the errors you can meet.
@@ -36,11 +36,22 @@ Agent a model the machine can reach. A `model` list falls back on `auth`.
36
36
 
37
37
  > failed to publish cassette
38
38
 
39
- Cause: yaag could not write the Cassette. Most often the parent directory of
40
- the `--record` path does not exist, or it is not writable.
39
+ Cause: yaag could not write the Cassette. The destination is not writable, or
40
+ something else occupies the name.
41
41
 
42
- Fix: create the directory first, then run again. The Run keeps its result; only
43
- the recording failed.
42
+ Fix: give a writable path, then run again.
43
+
44
+ ## cannot create the Cassette directory
45
+
46
+ <!-- quote: @yaag/runtime/src/cassette/run-checkpoint.ts -->
47
+
48
+ > cannot create the Cassette directory
49
+
50
+ Cause: yaag makes a missing directory of the `--record` path, and this one
51
+ could not be made. A name on the path is a file, or a parent refuses a write.
52
+
53
+ Fix: give a `--record` path yaag can make. The Run stops at the start, before
54
+ the first Agent, so no work is lost.
44
55
 
45
56
  ## Replay or resume mismatch
46
57
 
@@ -126,7 +137,8 @@ file at the start of a Run. A `--config` file that is not there, or any config
126
137
  file that yaag cannot read or parse, stops the Run at the start (exit 1).
127
138
 
128
139
  Fix: correct the path or the file. Give `--no-config` to ignore the global
129
- config and the project config.
140
+ config and the project config. [Configuration](configuration.md#locations)
141
+ names the three locations and the supported fields.
130
142
 
131
143
  Plain usage errors of the CLI exit with code 2 and print the usage text. See
132
144
  [the CLI reference](cli.md#usage).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaag/extension",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@earendil-works/pi-tui": "^0.84.0",
28
- "@yaag/cli": "0.8.0",
29
- "@yaag/runtime": "0.8.0",
30
- "@yaag/tui": "0.8.0",
28
+ "@yaag/cli": "0.8.2",
29
+ "@yaag/runtime": "0.8.2",
30
+ "@yaag/tui": "0.8.2",
31
31
  "nanoid": "^6.0.1"
32
32
  },
33
33
  "peerDependencies": {
@@ -8,12 +8,13 @@ import { fileURLToPath } from "node:url";
8
8
  /** Absolute path of the shipped `docs/` folder, with no trailing separator. */
9
9
  export const DOCS_ROOT = fileURLToPath(new URL("../../docs", import.meta.url));
10
10
 
11
- /** The five shipped pages, in reading order. */
11
+ /** The shipped pages, in reading order. */
12
12
  export const DOC_PAGES = [
13
13
  "getting-started.md",
14
14
  "authoring.md",
15
15
  "examples.md",
16
16
  "cli.md",
17
+ "configuration.md",
17
18
  "troubleshooting.md",
18
19
  ] as const;
19
20
 
@@ -28,7 +28,7 @@ export function yaagPromptBlock(directories: readonly string[]): string {
28
28
  "",
29
29
  "Full authoring surface (defineAgent, args schemas, ask limits, worktrees, model fallback):",
30
30
  "read `<program dir>/.yaag/types/runtime/index.d.ts`.",
31
- `Shipped docs (${DOCS_ROOT}): getting-started.md, authoring.md, examples.md, cli.md, troubleshooting.md.`,
31
+ `Shipped docs (${DOCS_ROOT}): getting-started.md, authoring.md, examples.md, cli.md, configuration.md, troubleshooting.md.`,
32
32
  ].join("\n");
33
33
  }
34
34