Files
seal-use/src/domains/seal/capabilities/index.ts
T

178 lines
6.0 KiB
TypeScript

import { identityCapabilities } from "./identity.js";
import { contactsCapabilities } from "./contacts.js";
import { insightCapabilities } from "./insight.js";
import { billingCapabilities } from "./billing.js";
import { rulesCapabilities } from "./rules.js";
import { webhookCapabilities } from "./webhook.js";
import { approvalRunsCapabilities } from "./approval-runs.js";
import { simulationCapabilities } from "./simulation.js";
import { deployCapabilities } from "./deploy.js";
import { hoseCapabilities } from "./hose.js";
import { preferenceCapabilities } from "./preference.js";
import { reportCapabilities } from "./reports.js";
export * from "./helpers.js";
export * from "./validate.js";
export const sealCapabilities = [
...identityCapabilities,
...contactsCapabilities,
...insightCapabilities,
...billingCapabilities,
...rulesCapabilities,
...webhookCapabilities,
...approvalRunsCapabilities,
...simulationCapabilities,
...deployCapabilities,
...hoseCapabilities,
...preferenceCapabilities,
...reportCapabilities
];
export type SealCapability = (typeof sealCapabilities)[number];
/**
* Registry naming boundary: these entries are INTERNAL domain capability handlers, NOT MCP tools.
* The camelCase `sealXxx` strings are identifiers for internal dispatch (`runCapability`) and for
* the MCP gateway allow-lists below — the MCP server itself only ever exposes the
* `seal_use` / `seal_use_write` gateway pair and never these names. CLI verbs such as
* `seal-use context` are the only human-facing names (see README "One registry, two doors").
*
* MCP read/write classification for the capability registry.
*
* The two sets are exhaustive by construction: `capabilities.test.ts` asserts they partition `sealCapabilities`
* exactly, so a newly added capability fails the suite until it is classified here. The read-only MCP tool
* (`seal_use`) may only invoke names in {@link SEAL_READ_ONLY_CAPABILITIES}; everything else is reachable
* solely through `seal_use_write`.
*
* Read-only means it reads tenant state, or writes only a local file. Anything that creates, updates,
* deletes, publishes, pushes, replays, uploads, activates or mints a credential counts as mutating —
* including when it reads like a query. `sealInsightRecordAnalyze` is the instructive case: it
* sounds like a read but issues a POST that starts an analysis server-side.
*/
export const SEAL_READ_ONLY_CAPABILITIES: ReadonlySet<string> = new Set([
"sealApprovalContextGet",
"sealApprovalDocumentGet",
"sealApprovalDocumentsList",
"sealApprovalRuleGet",
"sealApprovalRuleVersionDiff",
"sealApprovalRuleVersionGet",
"sealApprovalRuleVersionsList",
"sealApprovalRulesLint",
"sealApprovalRulesList",
"sealApprovalRulesExportCsv",
"sealApprovalRulesPull",
"sealApprovalRunAttachmentsGet",
"sealApprovalRunCitedRulesGet",
"sealApprovalRunDiagnose",
"sealApprovalRunDocumentSummaryGet",
"sealApprovalRunFlowGet",
"sealApprovalRunGet",
"sealApprovalRunLangfuseBridgeGet",
"sealApprovalRunPick",
"sealApprovalRunResultGet",
"sealApprovalRunUrlGet",
"sealApprovalRunsCount",
"sealApprovalRunsExport",
"sealApprovalRunsSearch",
"sealApprovalRunsStats",
"sealApprovalRunsSummary",
"sealApprovalSearch",
"sealApprovalStylePreferencesGet",
"sealBillingFeaturesList",
"sealBillingPlansList",
"sealBillingStatusGet",
"sealContactsDepartmentChildrenList",
"sealContactsDepartmentGet",
"sealContactsDepartmentUsersList",
"sealContactsDepartmentsRootList",
"sealContactsLastSyncTimeGet",
"sealDelegationList",
"sealDeployHosecloudGet",
"sealDeployHosecloudList",
"sealDeployHosecloudRequirements",
"sealDeployHosecloudStatus",
"sealExpensesList",
"sealHoseOutboundMessages",
"sealHoseOutboundSearch",
"sealInsightExport",
"sealInsightPerformanceGet",
"sealInsightRisksByTagGet",
"sealInsightStatsGet",
"sealInvoicesList",
"sealLlmConfigGet",
"sealLlmProvidersList",
"sealPermissionsAvailableList",
"sealPermissionsConfigsList",
"sealPreferenceGet",
"sealPreferenceThinkingDepthPoliciesList",
"sealReportDataGet",
"sealReportMonthlyGet",
"sealSessionGet",
"sealSimulationBatchGet",
"sealSimulationBatchRecordsGet",
"sealSimulationBatchStatus",
"sealSimulationBatchWait",
"sealSimulationBatchesList",
"sealSimulationFeishuApprovalDefinitionsList",
"sealSimulationIntegrationsGet",
"sealSimulationSpecificationsList",
"sealSimulationTemplatesGet",
"sealUserGet",
"sealUserSearch",
"sealWebhookGet",
"sealWebhookList",
"sealWebhookReady",
"sealWhoami"
]);
export const SEAL_MUTATING_CAPABILITIES: ReadonlySet<string> = new Set([
"sealApprovalDeleteDocument",
"sealApprovalDocumentCreate",
"sealApprovalDocumentUpdate",
"sealApprovalRuleCreate",
"sealApprovalRuleDelete",
"sealApprovalRuleUpdate",
"sealApprovalRuleVersionPublish",
"sealApprovalRulesClear",
"sealApprovalRulesRecode",
"sealApprovalRulesPush",
"sealApprovalStylePreferencesUpdate",
"sealDelegationCreate",
"sealDelegationRevoke",
"sealDeployHosecloudConfigure",
"sealDeployHosecloudSync",
"sealDeployHosecloudTestOutbound",
"sealHoseApprovalCallback",
"sealInsightRecordAnalyze",
"sealPreferenceDecisionUpdate",
"sealPreferenceThinkingDepthPoliciesRemove",
"sealPreferenceThinkingDepthPoliciesUpsert",
"sealPreferenceThinkingDepthSet",
"sealSimulationBatchClean",
"sealSimulationBatchCreate",
"sealSimulationMaterialPackageUpload",
"sealUserActivate",
"sealUserCreate",
"sealUserDelegationCreate",
"sealUserDelete",
"sealUserResetPassword",
"sealWebhookAdd",
"sealWebhookDelete",
"sealWebhookMaterialPack",
"sealWebhookReplay",
"sealWebhookUpdate"
]);
export function isReadOnlySealCapability(name: string): boolean {
return SEAL_READ_ONLY_CAPABILITIES.has(name);
}
const sealCapabilityByName = new Map<string, SealCapability>(
sealCapabilities.map((tool) => [tool.name, tool])
);
export function findSealCapability(name: string): SealCapability | undefined {
return sealCapabilityByName.get(name);
}