@robota-sdk/agent-preset 3.0.0-beta.83 → 3.0.0-beta.84

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +96 -39
  3. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @robota-sdk/agent-preset
2
2
 
3
+ ## 3.0.0-beta.84
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e8d70ac]
8
+ - @robota-sdk/agent-framework@3.0.0-beta.84
9
+
3
10
  ## 3.0.0-beta.83
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -1,67 +1,124 @@
1
- # Agent Preset
1
+ # @robota-sdk/agent-preset
2
2
 
3
- Preset contract and resolver for the Robota SDK. A preset is a named, pre-tuned bundle of
4
- `agent-framework` option overrides (persona, model/effort, permission posture, command-module
5
- selection, execution capabilities, autonomy). This package owns the `IPreset` contract, the
6
- built-in `default` preset, and the instance-scoped registry that resolves them.
3
+ Presets and output styles for the Robota SDK. A preset is a named bundle of
4
+ `@robota-sdk/agent-framework` session option overrides: persona, model and effort, permission
5
+ posture, command-module selection, execution capabilities and autonomy. An output style is a named
6
+ set of instructions for how responses are written. This package owns both contracts, the built-in
7
+ presets and styles, and the registries that resolve them.
7
8
 
8
9
  ## Installation
9
10
 
10
11
  ```bash
11
- npm install @robota-sdk/agent-preset
12
+ npm install @robota-sdk/agent-preset @robota-sdk/agent-framework
12
13
  ```
13
14
 
14
- ## Public API
15
+ Requires Node.js 22.12 or later.
16
+
17
+ ## Presets
15
18
 
16
19
  ```typescript
17
- import {
18
- createPresetRegistry,
19
- partitionExternalPresets,
20
- defaultPreset,
21
- } from '@robota-sdk/agent-preset';
22
- import type {
23
- IPreset,
24
- IResolvedPresetOptions,
25
- IPresetSummary,
26
- IResolvePresetContext,
27
- } from '@robota-sdk/agent-preset';
28
-
29
- // A registry is per-call and holds its own list: `[built-ins, ...externalPresets]`. With no
30
- // argument it is the built-ins. Two registries in one process never see each other's presets.
20
+ import { createPresetRegistry } from '@robota-sdk/agent-preset';
21
+
22
+ // A registry holds its own list: the built-ins plus any external presets you pass.
23
+ // Two registries in one process never see each other's presets.
31
24
  const registry = createPresetRegistry();
32
25
 
33
- // Resolve a preset into framework option overrides.
26
+ // Resolve a preset into session option overrides.
34
27
  // Precedence (low → high): preset < cliOverrides < explicit.
35
- const options = registry.resolvePreset('default', {
28
+ const options = registry.resolvePreset('careful-reviewer', {
36
29
  cliOverrides: { model: 'some-model' },
37
30
  explicit: { temperature: 0.2 },
38
31
  });
39
32
 
40
- // Discover presets for UX.
41
- const summaries = registry.listPresets(); // [{ id: 'default', title, description }, ...]
33
+ // List presets for a picker, or read one definition.
34
+ const summaries = registry.listPresets(); // [{ id, title, description }, ...]
35
+ const preset = registry.getPreset('autonomous-builder');
36
+ console.log(options, summaries, preset);
42
37
  ```
43
38
 
44
- The `default` preset carries no overrides, so resolving it is a pure no-op that reproduces the
45
- standard agent behaviour (no regression).
39
+ Resolving an unknown ID throws, naming the available presets. `deniedTools` from every layer are
40
+ combined rather than replaced. When no layer sets `permissionMode`, it comes from
41
+ `defaultPermissionMode`, or else from `autonomy` (`ask-first` and `balanced` map to `default`,
42
+ `act-first` to `acceptEdits`).
43
+
44
+ ### Built-in presets
46
45
 
47
- When migrating from the implicit Robota defaults, choose the agent name in your product and call
48
- `loadExternalPresetsFromDir(directory)` with a product-owned directory. The preset package no longer
49
- exports `DEFAULT_AGENT_NAME`, `defaultExternalPresetDir`, or the no-argument `loadExternalPresets`.
46
+ | ID | Posture |
47
+ | -------------------- | -------------------------------------------------------------------------------------- |
48
+ | `default` | No overrides; resolving it reproduces the standard agent behaviour |
49
+ | `autonomous-builder` | High effort, acts first, parallel subagents, self-verification |
50
+ | `careful-reviewer` | High effort, asks first, no parallel subagents, self-verification |
51
+ | `neutral-executor` | Medium effort, balanced autonomy, follows instructions literally, no self-verification |
50
52
 
51
- ## Dependency Position
53
+ `defaultPreset` and `autonomousBuilderPreset` are also exported as values.
52
54
 
55
+ ### External presets
56
+
57
+ External presets are JSON files in a directory your product chooses:
58
+
59
+ ```typescript
60
+ import { createPresetRegistry, loadExternalPresetsFromDir } from '@robota-sdk/agent-preset';
61
+
62
+ const { presets, loaded, errors } = loadExternalPresetsFromDir('/path/to/my-app/presets');
63
+ for (const { file, error } of errors) console.warn(`${file}: ${error}`);
64
+
65
+ const registry = createPresetRegistry(presets);
66
+ console.log(loaded);
53
67
  ```
54
- agent-framework ← neutral assembly + option-type SSOT
68
+
69
+ Each file is checked with `validateExternalPreset`. A malformed file, an ID that collides with a
70
+ built-in, or a duplicate ID is reported in `errors` and skipped; the rest still load. A missing
71
+ directory yields no presets. `partitionExternalPresets` applies the same collision rules to presets
72
+ you already have in memory.
73
+
74
+ ## Output styles
75
+
76
+ `createOutputStyleRegistry(sources)` combines the built-in styles (`default`, `concise`,
77
+ `proactive`, `explanatory`, `learning`) with Markdown style files from sources you pass
78
+ (`managed`, `user` or `project` scope, each with a precedence; a higher precedence wins). A style
79
+ file's ID is its file name without `.md`; it has optional frontmatter (`name`, `description`,
80
+ `keep-coding-instructions`, `token-cost`) and a non-empty body with the instructions. A file cannot
81
+ replace a built-in style. `loadOutputStylesFromSources` returns the styles plus per-file errors, and
82
+ `parseOutputStyleFile` parses one file.
83
+
84
+ ```typescript
85
+ import { createOutputStyleRegistry } from '@robota-sdk/agent-preset';
86
+
87
+ const styles = createOutputStyleRegistry([
88
+ {
89
+ scope: 'user',
90
+ displayName: '~/.my-app/output-styles',
91
+ precedence: 1,
92
+ files: [
93
+ {
94
+ fileName: 'terse.md',
95
+ content: '---\nname: Terse\ntoken-cost: low\n---\nAnswer in as few words as possible.',
96
+ },
97
+ ],
98
+ },
99
+ ]);
100
+
101
+ console.log(styles.listOutputStyles().map((style) => style.id));
102
+ const terse = styles.getOutputStyle('terse');
103
+ console.log(terse?.instructions);
104
+ ```
105
+
106
+ ## Where it sits
107
+
108
+ ```
109
+ agent-framework ← session option types this package overrides
55
110
  ↑
56
- agent-preset ← this package (preset contract + resolver)
111
+ agent-preset ← this package
57
112
  ↑
58
- agent-cli ← consumes createPresetRegistry (per-call resolution, ARCH-008)
59
- agent-command ← consumes the registry the HOST supplies, through the command-host adapters (ARCH-009)
113
+ agent-cli, agent-command, agent-product ← create registries and apply presets
60
114
  ```
61
115
 
62
- This package depends only on `@robota-sdk/agent-framework` and must not re-export it.
116
+ This package depends only on `@robota-sdk/agent-framework` and does not re-export it.
117
+
118
+ ## Documentation
119
+
120
+ - [docs/SPEC.md](./docs/SPEC.md) — package contract, precedence and design decisions
63
121
 
64
- ## Links
122
+ ## License
65
123
 
66
- - [npm](https://www.npmjs.com/package/@robota-sdk/agent-preset)
67
- - [GitHub](https://github.com/woojubb/robota)
124
+ Robota is dual-licensed under the [GNU AGPL-3.0](../../LICENSE) or a [commercial license](../../COMMERCIAL.md). See [LICENSING.md](../../LICENSING.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-preset",
3
- "version": "3.0.0-beta.83",
3
+ "version": "3.0.0-beta.84",
4
4
  "description": "Preset contract and resolver for the Robota SDK (IPreset, resolvePreset, listPresets, built-in presets)",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -33,9 +33,10 @@
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "https://github.com/woojubb/robota.git"
36
+ "url": "https://github.com/woojubb/robota.git",
37
+ "directory": "packages/agent-preset"
37
38
  },
38
- "homepage": "https://robota.io/",
39
+ "homepage": "https://docs.robota.io/en/packages/agent-preset/",
39
40
  "bugs": {
40
41
  "url": "https://github.com/woojubb/robota/issues"
41
42
  },
@@ -47,7 +48,7 @@
47
48
  "CHANGELOG.md"
48
49
  ],
49
50
  "dependencies": {
50
- "@robota-sdk/agent-framework": "3.0.0-beta.83"
51
+ "@robota-sdk/agent-framework": "3.0.0-beta.84"
51
52
  },
52
53
  "devDependencies": {
53
54
  "rimraf": "^5.0.10",