Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions plugins/data-machine/docs/core-system/tool-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ The `_callable` wrapper defers the full definition until a resolver needs it. Th
array(
'description' => 'Search the My Plugin index.',
'parameters' => array(
'query' => array(
'type' => 'string',
'required' => true,
'description' => 'Search terms.',
'type' => 'object',
'properties' => array(
'query' => array(
'type' => 'string',
'description' => 'Search terms.',
),
),
'required' => array( 'query' ),
),
'class' => MySearchTool::class,
'method' => 'handle_tool_call',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Apply source URL attribution to content based on configuration.
**Process**:
1. Check configuration (`link_handling` = 'append')
2. Validate source URL
3. Read the declared `content_format` from handler config (`html`, `markdown`, or `blocks`)
3. Read the explicit `content_format` from config (`html`, `markdown`, or `blocks`; defaults to `html`)
4. Generate source attribution in the same source format
5. Append to content

Expand Down
22 changes: 14 additions & 8 deletions plugins/data-machine/docs/development/hooks/engine-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ $tools = apply_filters( 'datamachine_tools', array() );
'method' => 'handle_tool_call',
'description' => 'Clear, AI-readable description.',
'parameters' => [
'query' => [
'type' => 'string',
'required' => true,
'description' => 'Search query',
'type' => 'object',
'properties' => [
'query' => [
'type' => 'string',
'description' => 'Search query',
],
],
'required' => ['query'],
],
'modes' => ['system'], // which modes can see this tool (required)
'requires_config' => true, // checked via datamachine_tool_configured
Expand All @@ -119,11 +122,14 @@ add_filter( 'datamachine_tools', function ( $tools ) {
'method' => 'handle_tool_call',
'description' => 'Search the My Plugin index.',
'parameters' => [
'query' => [
'type' => 'string',
'required' => true,
'description' => 'Search terms',
'type' => 'object',
'properties' => [
'query' => [
'type' => 'string',
'description' => 'Search terms',
],
],
'required' => ['query'],
],
'modes' => ['system'],
'requires_config' => false,
Expand Down
24 changes: 16 additions & 8 deletions plugins/data-machine/docs/handlers/publish/handlers-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,21 @@ add_filter('datamachine_tools', function($tools) {
'handler' => $handler_slug,
'description' => 'Publish content to WordPress',
'parameters' => [
'content' => [
'type' => 'string',
'required' => true,
'description' => 'Content to publish',
'type' => 'object',
'properties' => [
'content' => [
'type' => 'string',
'description' => 'Content to publish',
],
],
'required' => ['content'],
],
'handler_config' => $handler_config,
],
];
},
'handler' => 'wordpress_publish',
'client_context_bindings' => ['job_id'],
'modes' => ['pipeline'],
'access_level' => 'admin',
];
Expand Down Expand Up @@ -378,17 +382,21 @@ add_filter('datamachine_tools', function($tools) {
'handler' => $handler_slug,
'description' => 'Publish content to custom platform',
'parameters' => [
'content' => [
'type' => 'string',
'required' => true,
'description' => 'Content to publish',
'type' => 'object',
'properties' => [
'content' => [
'type' => 'string',
'description' => 'Content to publish',
],
],
'required' => ['content'],
],
'handler_config' => $handler_config,
],
];
},
'handler' => 'custom_platform',
'client_context_bindings' => ['job_id'],
'modes' => ['pipeline'],
'access_level' => 'admin',
];
Expand Down
10 changes: 7 additions & 3 deletions plugins/data-machine/docs/handlers/publish/wordpress-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,20 @@ class WordPress extends PublishHandler {

// 3. Get source URL and apply source attribution using helper
$source_url = $engine->getSourceUrl();
$content = WordPressPublishHelper::applySourceAttribution(
$content_format = $parameters['content_format'] ?? 'html';
$content = WordPressPublishHelper::applySourceAttribution(
$parameters['content'],
$source_url,
$handler_config
array(
'link_handling' => 'append',
'content_format' => $content_format,
)
);

// 4. Convert source content to the post type's stored format
$stored_content = ContentFormat::sourceToStored(
$content,
$parameters['content_format'] ?? 'html',
$content_format,
$handler_config['post_type']
);

Expand Down
44 changes: 24 additions & 20 deletions plugins/data-machine/inc/Abilities/Content/InsertContentAbility.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,31 @@ public static function getToolDefinition(): array {
'method' => 'handleToolCall',
'description' => 'Insert new content into a WordPress post at a specific position (beginning, end, or after a specific paragraph). Returns a canonical preview diff for user review.',
'parameters' => array(
'post_id' => array(
'type' => 'integer',
'description' => 'The post ID to insert content into.',
),
'blog_id' => array(
'type' => 'integer',
'description' => 'Optional multisite blog ID the post lives on. Omit for the current site.',
),
'content' => array(
'type' => 'string',
'description' => 'The new content to insert (wrapped in paragraph blocks automatically).',
),
'position' => array(
'type' => 'string',
'enum' => array( 'beginning', 'end', 'after_paragraph' ),
'description' => 'Where to insert the content.',
),
'target_paragraph_text' => array(
'type' => 'string',
'description' => 'Required when position is "after_paragraph". A short phrase (3-8 words) from the target paragraph.',
'type' => 'object',
'properties' => array(
'post_id' => array(
'type' => 'integer',
'description' => 'The post ID to insert content into.',
),
'blog_id' => array(
'type' => 'integer',
'description' => 'Optional multisite blog ID the post lives on. Omit for the current site.',
),
'content' => array(
'type' => 'string',
'description' => 'The new content to insert (wrapped in paragraph blocks automatically).',
),
'position' => array(
'type' => 'string',
'enum' => array( 'beginning', 'end', 'after_paragraph' ),
'description' => 'Where to insert the content.',
),
'target_paragraph_text' => array(
'type' => 'string',
'description' => 'Required when position is "after_paragraph". A short phrase (3-8 words) from the target paragraph.',
),
),
'required' => array( 'post_id', 'content', 'position' ),
),
);
}
Expand Down
Loading
Loading