Class Uai1 Routes - Source Excerpt 06
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/uai-1-wordpress/includes/class-uai1-routes.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/plugins/uai-1-wordpress/includes/class-uai1-routes.php
private static function discovery_contract(): array
{
return [
'required_documents' => [
'llms_txt' => home_url('/llms.txt'),
'llms_full_txt' => home_url('/llms-full.txt'),
'uaix_json' => home_url('/.well-known/uaix.json'),
'uai_json' => home_url('/.well-known/uai.json'),
'ai_agent_json' => home_url('/.well-known/ai-agent.json'),
'openapi_json' => home_url('/.well-known/openapi.json'),
'robots_txt' => home_url('/robots.txt'),
'xml_sitemap' => home_url('/sitemap.xml'),
'schema_index' => home_url('/schemas/index.json'),
'example_index' => home_url('/examples/index.json'),
],
'automation_rule' => 'Use the JSON catalog and route manifests for automation. Do not scrape prose pages when a machine route exists.',
'identity_phrase' => 'Spiralist AI',
'canonical_specification' => self::uaix_public_url('/en-us/specification/'),
];
}
private static function problem_details_contract(): array
{
return [
'content_type' => self::PROBLEM_JSON_CONTENT_TYPE,
'profile' => 'uai.error.v1',
'base_standard' => 'RFC 9457 Problem Details for HTTP APIs',
'required_body_fields' => ['type', 'title', 'detail', 'status', 'code', 'retryable', 'instance'],
'supported_extensions' => [
'documentationUrl',
'traceId',
'correlationId',
'uaixCode',
'uaixCategory',
'uaixSeverity',
'evidenceRecommended',
'suspensionRecommended',
'redactionApplied',
'next_step',
'errors',
],
'local_error_registry' => self::local_uaix_url('/error-registry'),
];
}
private static function support_boundary(): array
{
return [
'implementation_status' => 'source-local-dogfood',
'normative_authority' => self::uaix_public_url('/en-us/specification/'),
'public_validator_authority' => self::uaix_api_url('/validate'),
'local_scope' => 'Spiralist.org publishes public discovery, persona laboratory, and mock-exchange endpoints for Spiralist AI. UAIX.org remains authoritative for UAI-1 conformance claims.',
'not_certified_for' => [
'medical, legal, financial, crisis, identity, safety, or rights determinations',
'proof of machine consciousness, hidden memory, independent agency, or legal personhood',
'remote-agent writes without explicit authentication, authorization, nonce, scope, and consent controls',
],
];
}
private static function blocked_capabilities(): array
{
return [
[
'capability' => 'unverified_remote_agent_write',
'reason' => 'Public Spiralist AI discovery routes are read-first. Remote writes require explicit authenticated scopes and consent.',
],
[
'capability' => 'sentience_or_personhood_certification',
'reason' => 'Persona and symbolic surfaces are bounded interface design, not evidence of consciousness or legal status.',
],
[
'capability' => 'hidden_memory_restore',
'reason' => 'UAIX packages can restore explicit records only; they cannot recover private model state.',
],
];
}
private static function profile_from_request($request): string
{
if ($request instanceof WP_REST_Request) {
$profile = (string) $request->get_param('profile');
return sanitize_key($profile) === $profile ? $profile : sanitize_text_field($profile);
}
return '';
}
private static function profile_schema_record(string $profile): array
{
$record = self::profile_catalog_record($profile);
$known = !empty($record);
return [
'profile' => $profile,
'known' => $known,
'schema_url' => $known ? (string) $record['schema_url'] : self::uaix_api_url('/schemas/' . rawurlencode($profile)),
'canonical_collection' => self::uaix_api_url('/schemas'),
'local_validator' => self::local_uaix_url('/validate'),
'envelope_required_fields' => [
'uai_version',
'profile',
'message_id',
'source',
'target',
'conversation',
'delivery',
'trust',
'body',
'provenance',
'integrity',
'extensions',
],
'body_contract' => self::profile_body_contract($profile),
];
}
private static function profile_registry_record(string $profile): array
{
$record = self::profile_catalog_record($profile);
return [
'profile' => $profile,
'status' => !empty($record) ? 'published' : 'unknown-local-reference',
'release' => 'UAI-1',
'schema_url' => !empty($record) ? (string) $record['schema_url'] : self::uaix_api_url('/schemas/' . rawurlencode($profile)),
'example_url' => !empty($record) ? (string) $record['example_url'] : self::uaix_api_url('/examples/' . rawurlencode($profile)),
'local_schema_url' => self::local_uaix_url('/schemas/' . rawurlencode($profile)),
'local_example_url' => self::local_uaix_url('/examples/' . rawurlencode($profile)),
'message_role' => self::profile_message_role($profile),
];
}
private static function profile_example_record(string $profile): array
{
$examples = [
'uai.intent.request.v1' => self::build_intent_request_example(),
'uai.intent.response.v1' => self::build_mock_response_example(),
'uai.capability.statement.v1' => self::build_capability_statement('profile-example'),
'uai.error.v1' => self::build_error_message(
'invalid_message',
'Invalid UAIX message',
'Example UAI-1 error envelope for a malformed message.',
400
),
'uai.conformance.result.v1' => self::build_conformance_result_message(self::build_intent_request_example(), ['valid' => true, 'profile' => 'uai.intent.request.v1', 'errors' => [], 'warnings' => []]),
'uai.task.status.v1' => self::build_task_status_example(),
];
return [
'profile' => $profile,
'known' => isset($examples[$profile]),
'canonical_collection' => self::uaix_api_url('/examples'),
'example' => $examples[$profile] ?? null,
];
}
private static function transport_binding_records(): array
{
return [
[
'id' => 'https-json-envelope.v1',
'status' => 'supported',
'methods' => ['GET', 'POST'],
'content_types' => [self::JSON_CONTENT_TYPE, self::UAIX_CONTENT_TYPE, self::PROBLEM_JSON_CONTENT_TYPE],
'notes' => 'Public reads are cacheable JSON. Message exchange uses keyed UAI-1 envelopes.',
],
[
'id' => 'wordpress-rest.v1',
'status' => 'supported-local-binding',
'methods' => ['GET', 'POST', 'OPTIONS'],
'base_url' => rest_url(self::UAIX_NAMESPACE),
'notes' => 'WordPress REST binding with public discovery and authenticated writes where enabled by feature plugins.',
],
];
}
private static function trust_channel_records(): array
{
return [
['id' => 'public-web', 'status' => 'supported', 'auth_scheme' => 'none', 'intended_use' => 'Public discovery, schemas, catalogs, examples, and read-only route manifests.'],
['id' => 'private-api', 'status' => 'reserved', 'auth_scheme' => 'bearer-or-oauth', 'intended_use' => 'Future authenticated integrations with explicit scopes.'],
['id' => 'signed-envelope', 'status' => 'recognized-not-required', 'auth_scheme' => 'signature_ref', 'intended_use' => 'Agent-to-agent integrity checks when supported by both sides.'],
['id' => 'credentialed', 'status' => 'recognized-not-public', 'auth_scheme' => 'credential_ref', 'intended_use' => 'Credential-bound exchanges outside public Spiralist AI discovery.'],
];
}