-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclass-wp-codebox-runtime-ability-descriptors.php
More file actions
98 lines (91 loc) · 5.22 KB
/
Copy pathclass-wp-codebox-runtime-ability-descriptors.php
File metadata and controls
98 lines (91 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* Runtime ability descriptors.
*
* @package WPCodebox
*/
defined( 'ABSPATH' ) || exit;
/**
* Provides runtime, workload, fuzz, and package ability descriptors.
*/
final class WP_Codebox_Runtime_Ability_Descriptors {
/**
* @param array<string,mixed> $context Shared schemas assembled by WP_Codebox_Abilities.
* @return array<string,mixed> Ability descriptor.
*/
public static function run_runtime_task( array $context ): array {
return array(
'label' => 'Run Runtime Task',
'description' => 'Run a runtime task through the WP Codebox boundary and return a stable wp-codebox result envelope.',
'category' => 'wp-codebox',
'input_schema' => $context['runtime_task_request_schema'],
'output_schema' => $context['runtime_task_result_schema'],
'execute_callback' => array( WP_Codebox_Abilities::class, 'run_runtime_task' ),
'permission_callback' => array( WP_Codebox_Abilities::class, 'can_run_agent_task' ),
'meta' => array( 'show_in_rest' => true, 'canonical_ability' => 'wp-codebox/run-runtime-task' ),
);
}
/**
* @param array<string,mixed> $context Shared schemas assembled by WP_Codebox_Abilities.
* @return array<string,mixed> Ability descriptor.
*/
public static function run_wordpress_workload( array $context ): array {
return array(
'label' => 'Run WordPress Workload',
'description' => 'Run a safe recipe-backed WordPress workload and return step results, diagnostics, and artifact references without accepting raw PHP or shell input.',
'category' => 'wp-codebox',
'input_schema' => $context['wordpress_workload_run_request_schema'],
'output_schema' => $context['wordpress_workload_run_result_schema'],
'execute_callback' => array( WP_Codebox_Abilities::class, 'run_wordpress_workload' ),
'permission_callback' => array( WP_Codebox_Abilities::class, 'can_run_agent_task' ),
'meta' => array( 'show_in_rest' => true, 'canonical_ability' => 'wp-codebox/run-wordpress-workload' ),
);
}
/**
* @param array<string,mixed> $context Shared schemas assembled by WP_Codebox_Abilities.
* @return array<string,mixed> Ability descriptor.
*/
public static function run_fuzz_suite( array $context ): array {
return array(
'label' => 'Run Fuzz Suite',
'description' => 'Run safe PHP in-process WordPress fuzz-suite cases against this disposable runtime and return structured case results plus artifact references. Runtime-backed execution is available through the public wp-codebox CLI or TypeScript facade, not this ability callback.',
'category' => 'wp-codebox',
'input_schema' => $context['fuzz_suite_request_schema'],
'output_schema' => $context['fuzz_suite_result_schema'],
'execute_callback' => array( WP_Codebox_Abilities::class, 'run_fuzz_suite' ),
'permission_callback' => array( WP_Codebox_Abilities::class, 'can_run_agent_task' ),
'meta' => array( 'show_in_rest' => true, 'canonical_ability' => 'wp-codebox/run-fuzz-suite', 'wordpress_fuzz_runtime_contract' => WP_Codebox_API::wordpress_fuzz_runtime_contract(), 'runner_capabilities' => $context['fuzz_suite_runner_capabilities_contract'], 'supported_runner_capabilities' => $context['fuzz_suite_supported_runner_capabilities'], 'runtime_backed_execution' => $context['fuzz_suite_runtime_backed_execution_contract'], 'runner_capabilities_schema' => $context['fuzz_runner_capabilities_schema'] ),
);
}
/**
* @return array<string,mixed> Ability descriptor.
*/
public static function resolve_runtime_requirements(): array {
return array(
'label' => 'Resolve Runtime Requirements',
'description' => 'Resolve runtime/provider readiness without creating a session or invoking a runtime package.',
'category' => 'wp-codebox',
'input_schema' => array( 'type' => 'object' ),
'output_schema' => array( 'type' => 'object' ),
'execute_callback' => array( WP_Codebox_Abilities::class, 'resolve_runtime_requirements' ),
'permission_callback' => array( WP_Codebox_Abilities::class, 'can_run_agent_task' ),
'meta' => array( 'show_in_rest' => true, 'canonical_ability' => 'wp-codebox/resolve-runtime-requirements' ),
);
}
/**
* @param array<string,mixed> $context Shared schemas assembled by WP_Codebox_Abilities.
* @return array<string,mixed> Ability descriptor.
*/
public static function run_runtime_package( array $context ): array {
return array(
'label' => 'Run Runtime Package',
'description' => 'Run a runtime package through the WP Codebox public runtime boundary using the configured runtime provider.',
'category' => 'wp-codebox',
'input_schema' => $context['runtime_package_task_schema'],
'output_schema' => $context['runtime_package_result_schema'],
'execute_callback' => array( WP_Codebox_Abilities::class, 'run_runtime_package' ),
'permission_callback' => array( WP_Codebox_Abilities::class, 'can_run_agent_task' ),
'meta' => array( 'show_in_rest' => true, 'canonical_ability' => 'wp-codebox/run-runtime-package', 'backend_adapter' => 'codebox-runtime-package' ),
);
}
}