import { EMPTY_OBJECT_SCHEMA, STRING_SCHEMA, BOOLEAN_SCHEMA, NUMBER_SCHEMA, arraySchema, objectSchema, bodyEnvelopeSchema, methodDescriptor, runtimeEventId } from './method-catalog-shared.js';
import { GRAPHQL_VARIABLES_SCHEMA, METADATA_SCHEMA, } from './operator-contract-schemas-shared.js';
import { KNOWLEDGE_BATCH_INGEST_RESULT_SCHEMA, KNOWLEDGE_CONSOLIDATION_DECISION_SCHEMA, KNOWLEDGE_CANDIDATE_OUTPUT_SCHEMA, KNOWLEDGE_CANDIDATES_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTOR_INGEST_INPUT_SCHEMA, KNOWLEDGE_CONNECTOR_DOCTOR_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTORS_OUTPUT_SCHEMA, KNOWLEDGE_CONNECTOR_ENTITY_OUTPUT_SCHEMA, KNOWLEDGE_EXTRACTION_OUTPUT_SCHEMA, KNOWLEDGE_EXTRACTIONS_OUTPUT_SCHEMA, KNOWLEDGE_GRAPHQL_EXECUTE_OUTPUT_SCHEMA, KNOWLEDGE_GRAPHQL_SCHEMA_OUTPUT_SCHEMA, KNOWLEDGE_INGEST_RESULT_SCHEMA, KNOWLEDGE_ITEM_ENTITY_OUTPUT_SCHEMA, KNOWLEDGE_JOB_OUTPUT_SCHEMA, KNOWLEDGE_JOB_RUN_OUTPUT_SCHEMA, KNOWLEDGE_JOB_RUN_REQUEST_SCHEMA, KNOWLEDGE_JOB_RUNS_OUTPUT_SCHEMA, KNOWLEDGE_JOBS_OUTPUT_SCHEMA, KNOWLEDGE_LINT_OUTPUT_SCHEMA, KNOWLEDGE_MATERIALIZED_PROJECTION_SCHEMA, KNOWLEDGE_NODES_OUTPUT_SCHEMA, KNOWLEDGE_PACKET_SCHEMA, KNOWLEDGE_PACKET_DETAIL_SCHEMA, KNOWLEDGE_PROJECTION_BUNDLE_SCHEMA, KNOWLEDGE_PROJECTION_TARGETS_OUTPUT_SCHEMA, KNOWLEDGE_REINDEX_OUTPUT_SCHEMA, KNOWLEDGE_REPORT_OUTPUT_SCHEMA, KNOWLEDGE_REPORTS_OUTPUT_SCHEMA, KNOWLEDGE_SCHEDULE_INPUT_SCHEMA, KNOWLEDGE_SCHEDULE_OUTPUT_SCHEMA, KNOWLEDGE_SCHEDULES_OUTPUT_SCHEMA, KNOWLEDGE_SEARCH_OUTPUT_SCHEMA, KNOWLEDGE_SOURCE_TYPE_SCHEMA, KNOWLEDGE_SOURCES_OUTPUT_SCHEMA, KNOWLEDGE_STATUS_SCHEMA, KNOWLEDGE_ISSUES_OUTPUT_SCHEMA, KNOWLEDGE_USAGE_OUTPUT_SCHEMA, } from './operator-contract-schemas-knowledge.js';
export const builtinGatewayKnowledgeMethodDescriptors = [
    methodDescriptor({
        id: 'knowledge.status',
        title: 'Knowledge Status',
        description: 'Return structured knowledge runtime status and record counts.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/status' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_STATUS_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.sources.list',
        title: 'List Knowledge Sources',
        description: 'Return ingested structured knowledge sources.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/sources' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_SOURCES_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.nodes.list',
        title: 'List Knowledge Nodes',
        description: 'Return compiled knowledge nodes.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/nodes' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_NODES_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.issues.list',
        title: 'List Knowledge Issues',
        description: 'Return current knowledge lint and health issues.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/issues' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_ISSUES_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.item.get',
        title: 'Get Knowledge Item',
        description: 'Return a single structured knowledge source, node, or issue with linked relations.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/items/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_ITEM_ENTITY_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.connectors.list',
        title: 'List Knowledge Connectors',
        description: 'Return discoverable knowledge ingest connectors with input metadata and examples.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/connectors' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_CONNECTORS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.connector.doctor',
        title: 'Doctor Knowledge Connector',
        description: 'Return readiness and setup diagnostics for a knowledge connector.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/connectors/{id}/doctor' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_CONNECTOR_DOCTOR_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.connector.get',
        title: 'Get Knowledge Connector',
        description: 'Return a single knowledge connector manifest.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/connectors/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_CONNECTOR_ENTITY_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.ingest.url',
        title: 'Ingest URL Into Knowledge',
        description: 'Fetch, snapshot, and compile a URL into the structured knowledge store.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/ingest/url' },
        inputSchema: bodyEnvelopeSchema({
            url: STRING_SCHEMA,
            title: STRING_SCHEMA,
            sourceType: KNOWLEDGE_SOURCE_TYPE_SCHEMA,
            sessionId: STRING_SCHEMA,
            tags: arraySchema(STRING_SCHEMA),
            folderPath: STRING_SCHEMA,
            allowPrivateHosts: BOOLEAN_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['url']),
        outputSchema: KNOWLEDGE_INGEST_RESULT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.ingest.bookmarks',
        title: 'Import Bookmark File',
        description: 'Parse a bookmark export file and ingest its URLs into the structured knowledge store.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/ingest/bookmarks' },
        inputSchema: bodyEnvelopeSchema({
            path: STRING_SCHEMA,
            sessionId: STRING_SCHEMA,
            allowPrivateHosts: BOOLEAN_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['path']),
        outputSchema: KNOWLEDGE_BATCH_INGEST_RESULT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.ingest.urls',
        title: 'Import URL List',
        description: 'Parse a URL list file and ingest its entries into the structured knowledge store.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/ingest/urls' },
        inputSchema: bodyEnvelopeSchema({
            path: STRING_SCHEMA,
            sessionId: STRING_SCHEMA,
            allowPrivateHosts: BOOLEAN_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['path']),
        outputSchema: KNOWLEDGE_BATCH_INGEST_RESULT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.ingest.connector',
        title: 'Ingest Connector Input',
        description: 'Resolve a knowledge connector against inline input, inline content, or file-backed content.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/ingest/connector' },
        inputSchema: KNOWLEDGE_CONNECTOR_INGEST_INPUT_SCHEMA,
        outputSchema: KNOWLEDGE_BATCH_INGEST_RESULT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.ingest.artifact',
        title: 'Ingest Artifact Into Knowledge',
        description: 'Snapshot a local path, remote URI, or existing artifact into the structured knowledge store and run structured extraction.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/ingest/artifact' },
        events: [runtimeEventId('knowledge')],
        inputSchema: bodyEnvelopeSchema({
            artifactId: STRING_SCHEMA,
            path: STRING_SCHEMA,
            uri: STRING_SCHEMA,
            sourceType: KNOWLEDGE_SOURCE_TYPE_SCHEMA,
            title: STRING_SCHEMA,
            sessionId: STRING_SCHEMA,
            tags: arraySchema(STRING_SCHEMA),
            folderPath: STRING_SCHEMA,
            allowPrivateHosts: BOOLEAN_SCHEMA,
            metadata: METADATA_SCHEMA,
        }),
        outputSchema: KNOWLEDGE_INGEST_RESULT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.search',
        title: 'Search Structured Knowledge',
        description: 'Search structured knowledge sources and nodes with compact ranked results.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'POST', path: '/api/knowledge/search' },
        inputSchema: bodyEnvelopeSchema({
            query: STRING_SCHEMA,
            limit: NUMBER_SCHEMA,
            includeSources: BOOLEAN_SCHEMA,
            includeNodes: BOOLEAN_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['query']),
        outputSchema: KNOWLEDGE_SEARCH_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.extractions.list',
        title: 'List Knowledge Extractions',
        description: 'Return structured extraction records for ingested sources.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/extractions' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA, sourceId: STRING_SCHEMA }),
        outputSchema: KNOWLEDGE_EXTRACTIONS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.extraction.get',
        title: 'Get Knowledge Extraction',
        description: 'Return a single knowledge extraction record.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/extractions/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_EXTRACTION_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.source.extraction.get',
        title: 'Get Source Extraction',
        description: 'Return the structured extraction record for a single knowledge source.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/sources/{id}/extraction' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_EXTRACTION_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.packet',
        title: 'Build Knowledge Packet',
        description: 'Build a compact structured knowledge packet for a task and write scope.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'POST', path: '/api/knowledge/packet' },
        inputSchema: bodyEnvelopeSchema({
            task: STRING_SCHEMA,
            writeScope: arraySchema(STRING_SCHEMA),
            budgetLimit: NUMBER_SCHEMA,
            detail: KNOWLEDGE_PACKET_DETAIL_SCHEMA,
        }, ['task']),
        outputSchema: KNOWLEDGE_PACKET_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.usage.list',
        title: 'List Knowledge Usage',
        description: 'Return the recent knowledge usage ledger for packet hits, search hits, and item inspection.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/usage' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA, targetKind: STRING_SCHEMA, targetId: STRING_SCHEMA, usageKind: STRING_SCHEMA }),
        outputSchema: KNOWLEDGE_USAGE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.candidates.list',
        title: 'List Consolidation Candidates',
        description: 'Return scored consolidation candidates for durable memory promotion, review, or source refresh.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/candidates' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA, status: STRING_SCHEMA, subjectKind: STRING_SCHEMA, subjectId: STRING_SCHEMA }),
        outputSchema: KNOWLEDGE_CANDIDATES_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.candidate.get',
        title: 'Get Consolidation Candidate',
        description: 'Return a single consolidation candidate.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/candidates/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_CANDIDATE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.candidate.decide',
        title: 'Decide Consolidation Candidate',
        description: 'Accept, reject, or supersede a knowledge consolidation candidate.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/candidates/{id}/decide' },
        inputSchema: bodyEnvelopeSchema({
            decision: KNOWLEDGE_CONSOLIDATION_DECISION_SCHEMA,
            decidedBy: STRING_SCHEMA,
            reason: STRING_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['decision']),
        outputSchema: KNOWLEDGE_CANDIDATE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.reports.list',
        title: 'List Consolidation Reports',
        description: 'Return deterministic knowledge consolidation reports.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/reports' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_REPORTS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.report.get',
        title: 'Get Consolidation Report',
        description: 'Return a single knowledge consolidation report.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/reports/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_REPORT_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.jobs.list',
        title: 'List Knowledge Jobs',
        description: 'Return built-in structured knowledge maintenance jobs.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/jobs' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_JOBS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.job.get',
        title: 'Get Knowledge Job',
        description: 'Return a single knowledge job definition.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/jobs/{jobId}' },
        inputSchema: objectSchema({ jobId: STRING_SCHEMA }, ['jobId']),
        outputSchema: KNOWLEDGE_JOB_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.job-runs.list',
        title: 'List Knowledge Job Runs',
        description: 'Return recent knowledge job runs.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/job-runs' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA, jobId: STRING_SCHEMA }),
        outputSchema: KNOWLEDGE_JOB_RUNS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.schedules.list',
        title: 'List Knowledge Schedules',
        description: 'Return managed schedules for background knowledge maintenance jobs.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/schedules' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_SCHEDULES_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.schedule.get',
        title: 'Get Knowledge Schedule',
        description: 'Return a single managed knowledge schedule.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/schedules/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: KNOWLEDGE_SCHEDULE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.schedule.save',
        title: 'Save Knowledge Schedule',
        description: 'Create or update a managed schedule for a knowledge maintenance job.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/schedules' },
        inputSchema: bodyEnvelopeSchema({
            id: STRING_SCHEMA,
            jobId: STRING_SCHEMA,
            label: STRING_SCHEMA,
            enabled: BOOLEAN_SCHEMA,
            schedule: KNOWLEDGE_SCHEDULE_INPUT_SCHEMA,
            metadata: METADATA_SCHEMA,
        }, ['jobId', 'schedule']),
        outputSchema: KNOWLEDGE_SCHEDULE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.schedule.delete',
        title: 'Delete Knowledge Schedule',
        description: 'Delete a managed knowledge schedule.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'DELETE', path: '/api/knowledge/schedules/{id}' },
        inputSchema: objectSchema({ id: STRING_SCHEMA }, ['id']),
        outputSchema: objectSchema({ deleted: BOOLEAN_SCHEMA }, ['deleted'], { additionalProperties: false }),
    }),
    methodDescriptor({
        id: 'knowledge.schedule.enable',
        title: 'Set Knowledge Schedule Enabled',
        description: 'Enable or disable a managed knowledge schedule.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/schedules/{id}/enabled' },
        inputSchema: bodyEnvelopeSchema({
            enabled: BOOLEAN_SCHEMA,
        }, ['enabled']),
        outputSchema: KNOWLEDGE_SCHEDULE_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.job.run',
        title: 'Run Knowledge Job',
        description: 'Queue or run a structured knowledge maintenance job.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/jobs/{jobId}/run' },
        events: [runtimeEventId('knowledge')],
        inputSchema: KNOWLEDGE_JOB_RUN_REQUEST_SCHEMA,
        outputSchema: KNOWLEDGE_JOB_RUN_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.lint',
        title: 'Lint Structured Knowledge',
        description: 'Run deterministic knowledge lint checks and return the current issues.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/lint' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_LINT_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.reindex',
        title: 'Reindex Structured Knowledge',
        description: 'Rebuild derived knowledge relations and mirror reviewed memory into the structured knowledge store.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/reindex' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_REINDEX_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.projections.list',
        title: 'List Knowledge Projections',
        description: 'Return renderable markdown/wiki projection targets for the knowledge domain.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/projections' },
        inputSchema: objectSchema({ limit: NUMBER_SCHEMA }),
        outputSchema: KNOWLEDGE_PROJECTION_TARGETS_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.projection.render',
        title: 'Render Knowledge Projection',
        description: 'Render a markdown/wiki projection from the canonical structured knowledge store.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'POST', path: '/api/knowledge/projections/render' },
        inputSchema: bodyEnvelopeSchema({
            kind: STRING_SCHEMA,
            id: STRING_SCHEMA,
            limit: NUMBER_SCHEMA,
        }, ['kind']),
        outputSchema: KNOWLEDGE_PROJECTION_BUNDLE_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.projection.materialize',
        title: 'Materialize Knowledge Projection',
        description: 'Render and persist a markdown/wiki projection as a derived artifact.',
        category: 'knowledge',
        scopes: ['write:knowledge'],
        access: 'admin',
        http: { method: 'POST', path: '/api/knowledge/projections/materialize' },
        inputSchema: bodyEnvelopeSchema({
            kind: STRING_SCHEMA,
            id: STRING_SCHEMA,
            limit: NUMBER_SCHEMA,
        }, ['kind']),
        outputSchema: KNOWLEDGE_MATERIALIZED_PROJECTION_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.graphql.schema',
        title: 'Knowledge GraphQL Schema',
        description: 'Return the SDL for the dedicated knowledge GraphQL endpoint.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'GET', path: '/api/knowledge/graphql/schema' },
        inputSchema: EMPTY_OBJECT_SCHEMA,
        outputSchema: KNOWLEDGE_GRAPHQL_SCHEMA_OUTPUT_SCHEMA,
    }),
    methodDescriptor({
        id: 'knowledge.graphql.execute',
        title: 'Execute Knowledge GraphQL',
        description: 'Execute a GraphQL query or mutation against the dedicated knowledge domain endpoint.',
        category: 'knowledge',
        scopes: ['read:knowledge'],
        http: { method: 'POST', path: '/api/knowledge/graphql' },
        inputSchema: bodyEnvelopeSchema({
            query: STRING_SCHEMA,
            operationName: STRING_SCHEMA,
            variables: GRAPHQL_VARIABLES_SCHEMA,
        }, ['query']),
        outputSchema: KNOWLEDGE_GRAPHQL_EXECUTE_OUTPUT_SCHEMA,
    }),
];
