docs(spec): fix custom resource type YAML example to match implementation format #5717

Closed
HAL9000 wants to merge 1 commits from spec/fix-resource-type-yaml-format-5622 into master
+43 -47
View File
@@ -24503,58 +24503,54 @@ Custom resource types are defined in YAML configuration files and registered via
<div class="highlight"><pre><code>
<span style="opacity: 0.7;"># File: resource-types/database.yaml</span>
<span style="color: cyan; font-weight: 600;">cleveragents</span>:
<span style="color: cyan; font-weight: 600;">version</span>: <span style="color: #66cc66;">&quot;3.0&quot;</span>
<span style="color: cyan; font-weight: 600;">name</span>: local/database
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;A SQL database (PostgreSQL, MySQL, SQLite, etc.)&quot;</span>
<span style="color: cyan; font-weight: 600;">resource_kind</span>: physical
<span style="color: cyan; font-weight: 600;">user_addable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">resource_type</span>:
<span style="color: cyan; font-weight: 600;">name</span>: local/database
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;A SQL database (PostgreSQL, MySQL, SQLite, etc.)&quot;</span>
<span style="color: cyan; font-weight: 600;">physical_or_virtual</span>: physical
<span style="color: cyan; font-weight: 600;">user_addable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="opacity: 0.7;"># CLI arguments for `agents resource add local/database`</span>
<span style="color: cyan; font-weight: 600;">cli_args</span>:
- <span style="color: cyan; font-weight: 600;">name</span>: connection-string
<span style="color: cyan; font-weight: 600;">type</span>: string
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Database connection string (e.g., postgresql://host/dbname)&quot;</span>
<span style="color: cyan; font-weight: 600;">validation_pattern</span>: <span style="color: #66cc66;">&quot;^(postgresql|mysql|sqlite)://&quot;</span>
- <span style="color: cyan; font-weight: 600;">name</span>: schema
<span style="color: cyan; font-weight: 600;">type</span>: string
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Default schema to use&quot;</span>
- <span style="color: cyan; font-weight: 600;">name</span>: read-only
<span style="color: cyan; font-weight: 600;">type</span>: boolean
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">default</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Whether the database should be treated as read-only&quot;</span>
<span style="opacity: 0.7;"> # CLI arguments for `agents resource add local/database`</span>
<span style="color: cyan; font-weight: 600;">cli_arguments</span>:
- <span style="color: cyan;">name</span>: connection-string
<span style="color: cyan; font-weight: 600;">type</span>: string
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Database connection string (e.g., postgresql://host/dbname)&quot;</span>
<span style="color: cyan; font-weight: 600;">validation</span>:
<span style="color: cyan; font-weight: 600;">pattern</span>: <span style="color: #66cc66;">&quot;^(postgresql|mysql|sqlite)://&quot;</span>
- <span style="color: cyan;">name</span>: schema
<span style="color: cyan; font-weight: 600;">type</span>: string
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Default schema to use&quot;</span>
- <span style="color: cyan;">name</span>: read-only
<span style="color: cyan; font-weight: 600;">type</span>: boolean
<span style="color: cyan; font-weight: 600;">required</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">default</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Whether the database should be treated as read-only&quot;</span>
<span style="opacity: 0.7;"># Sandbox and handler</span>
<span style="color: cyan; font-weight: 600;">sandbox_strategy</span>: transaction_rollback
<span style="color: cyan; font-weight: 600;">handler</span>:
<span style="color: cyan; font-weight: 600;">class</span>: DatabaseHandler
<span style="color: cyan; font-weight: 600;">module</span>: cleveragents.resource.handlers.database
<span style="opacity: 0.7;"> # Sandbox and handler</span>
<span style="color: cyan; font-weight: 600;">sandbox_strategy</span>: transaction_rollback
<span style="color: cyan; font-weight: 600;">handler</span>: DatabaseHandler
<span style="color: cyan; font-weight: 600;">checkpointable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="opacity: 0.7;"># Parent types (empty means can be top-level)</span>
<span style="color: cyan; font-weight: 600;">parent_types</span>: []
<span style="opacity: 0.7;"> # Allowed parent types (empty means can be top-level)</span>
<span style="color: cyan; font-weight: 600;">allowed_parent_types</span>: []
<span style="opacity: 0.7;"># Child types</span>
<span style="color: cyan; font-weight: 600;">child_types</span>:
- <span style="color: cyan; font-weight: 600;">type</span>: local/db-schema
<span style="color: cyan; font-weight: 600;">auto_discover</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">manual_link</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Discovered database schemas&quot;</span>
- <span style="color: cyan; font-weight: 600;">type</span>: local/db-table
<span style="color: cyan; font-weight: 600;">auto_discover</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">manual_link</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Discovered tables within schemas&quot;</span>
<span style="opacity: 0.7;"> # Child types</span>
<span style="color: cyan; font-weight: 600;">child_types</span>:
- <span style="color: cyan;">type</span>: local/db-schema
<span style="color: cyan; font-weight: 600;">auto_discover</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">manual_link</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Discovered database schemas&quot;</span>
- <span style="color: cyan;">type</span>: local/db-table
<span style="color: cyan; font-weight: 600;">auto_discover</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">manual_link</span>: <span style="color: magenta; font-weight: 600;">false</span>
<span style="color: cyan; font-weight: 600;">description</span>: <span style="color: #66cc66;">&quot;Discovered tables within schemas&quot;</span>
<span style="opacity: 0.7;"> # Capabilities</span>
<span style="color: cyan; font-weight: 600;">capabilities</span>:
<span style="color: cyan; font-weight: 600;">readable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">writable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">sandboxable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">checkpointable</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="opacity: 0.7;"># Capabilities</span>
<span style="color: cyan; font-weight: 600;">capabilities</span>:
<span style="color: cyan; font-weight: 600;">read</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">write</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">sandbox</span>: <span style="color: magenta; font-weight: 600;">true</span>
<span style="color: cyan; font-weight: 600;">checkpoint</span>: <span style="color: magenta; font-weight: 600;">true</span>
</code></pre></div>
When this type is registered: