Merge pull request #197 from yunyingk/codex/camel-capability-ids

Camel-case capability IDs and rename the MCP gateway pair
This commit is contained in:
yunyingk authored and GitHub committed 2026-09-30 16:18:36 +08:00
commit 2a5fb3d9c4
41 files changed
+466 -466

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
## Project Structure & Module Organization
This is a Bun + TypeScript toolkit for the `seal-use` CLI and a local stdio MCP server (`seal-use mcp`). Entry points are `src/cli.ts`, `src/server.ts`, and `src/probe.ts`. Shared config, auth, token, and HTTP code is under `src/core/`. Seal-specific API and logic is under `src/domains/seal/`; the capability registry under `src/domains/seal/capabilities/` holds the shared handlers dispatched by the CLI (`runCapability`) and allow-listed by the MCP gateways. `seal_*` strings are internal registry identifiers — the MCP surface only ever exposes the `seal_cli` / `seal_cli_write` gateway pair, never these names (see README "One registry, two doors").
This is a Bun + TypeScript toolkit for the `seal-use` CLI and a local stdio MCP server (`seal-use mcp`). Entry points are `src/cli.ts`, `src/server.ts`, and `src/probe.ts`. Shared config, auth, token, and HTTP code is under `src/core/`. Seal-specific API and logic is under `src/domains/seal/`; the capability registry under `src/domains/seal/capabilities/` holds the shared handlers dispatched by the CLI (`runCapability`) and allow-listed by the MCP gateways. Capability IDs are camelCase internal registry identifiers (for example `sealApprovalContextGet`) — the MCP surface only ever exposes the `seal_use_mcp` / `seal_use_mcp_write` gateway pair, never these names (see README "One registry, two doors").
The repository doubles as a ZCode plugin: `.zcode-plugin/plugin.json` declares a skills-only plugin manifest and the agent skill lives under `skills/seal-use/`. The plugin ships no MCP surface; the local MCP runs from the CLI (`seal-use mcp`, or the `mcp-config` snippet for Cursor/Claude Desktop). The in-repo `.agents/skills/seal-use` symlink has been dropped; workspace and Codex skill loading use the global `~/.agents/skills/seal-use` copy installed by `seal-use skill install`.
+7 -7
View File
@@ -146,7 +146,7 @@ The canonical plugin skill lives at `skills/seal-use`. There is no in-repo `.age
The repository is also a ZCode plugin. Install `seal-use` from the `yingqing-plugins` marketplace in **Settings → Plugin Management**, or add this repository as a local plugin directory while developing. The plugin ships the `skills/seal-use` skill; it has no MCP surface. For MCP locally, paste the snippet from `seal-use mcp-config` into your host — it starts `seal-use mcp` with `SEAL_USE_MCP_ENABLED=true`, which the server needs before it exposes any tool.
The plugin exposes no MCP tools. The `seal_cli` / `seal_cli_write` tools exist only on the local MCP server started by `seal-use mcp` (or by whatever host consumes the `mcp-config` snippet), where they accept the same command syntax as the global CLI.
The plugin exposes no MCP tools. The `seal_use_mcp` / `seal_use_mcp_write` tools exist only on the local MCP server started by `seal-use mcp` (or by whatever host consumes the `mcp-config` snippet), where they accept the same command syntax as the global CLI.
For a standalone compiled CLI, build and run the binary from a checkout:
@@ -224,14 +224,14 @@ All approval/logic lives once in the capability registry under `src/domains/seal
| Surface | Entry | Naming |
| --- | --- | --- |
| CLI (primary) | `seal-use <area> <verb>` via `runCapability` | Kebab verbs: `seal-use context`, `seal-use rules get` |
| Local MCP server | `seal_cli` / `seal_cli_write` gateways that execute a CLI command string | Gateway names only — the registry IDs are the allow-list, never advertised as tools |
| Local MCP server | `seal_use_mcp` / `seal_use_mcp_write` gateways that execute a CLI command string | Gateway names only — the registry IDs are the allow-list, never advertised as tools |
`seal_*` strings are internal registry identifiers: they are dispatch IDs inside the codebase and they are **not** MCP tool names — no MCP client will ever see them in `tools/list`. If you are reading code and a `seal_*` name looks like it should be an MCP tool, that instinct is the trap this note exists to prevent; check `src/server.ts` for the actual (two-gateway) MCP surface.
Internally, capability IDs are camelCase (for example `sealApprovalContextGet`): they are dispatch IDs inside the codebase and they are **not** MCP tool names — no MCP client will ever see them in `tools/list`. If you are reading code and an internal capability ID looks like it should be an MCP tool, that instinct is the trap this note exists to prevent; check `src/server.ts` for the actual (two-gateway) MCP surface.
The MCP server exposes two tools — and only when `SEAL_USE_MCP_ENABLED=true`, which is what the `seal-use mcp-config` snippet carries; without that flag `tools/list` answers with an empty list:
- `seal_cli` runs read-only commands and refuses anything that mutates tenant state, self-updates, or starts a server.
- `seal_cli_write` runs the same dispatcher with mutating commands available; confirm the exact command with the user before calling it.
- `seal_use_mcp` runs read-only commands and refuses anything that mutates tenant state, self-updates, or starts a server.
- `seal_use_mcp_write` runs the same dispatcher with mutating commands available; confirm the exact command with the user before calling it.
Both take the command as a string:
@@ -245,7 +245,7 @@ Both run the same CLI dispatcher as the global binary, so `config` and `update`
## CLI-First Architecture
All Agent and automation capabilities are accessed through standard `seal-use <command>` CLI invocations (or through the `seal_cli` / `seal_cli_write` MCP tools passing the command string). Internal domain services output pure, parseable JSON on `stdout`, with human diagnostics and suggestions routed to `stderr`.
All Agent and automation capabilities are accessed through standard `seal-use <command>` CLI invocations (or through the `seal_use_mcp` / `seal_use_mcp_write` MCP tools passing the command string). Internal domain services output pure, parseable JSON on `stdout`, with human diagnostics and suggestions routed to `stderr`.
Key CLI command groups:
- **`seal-use corps ...`**: enterprise tenant management, onboarding, switching, and assistance link intake.
@@ -287,7 +287,7 @@ When `_langfuseTraceId` exists, downstream tools should fetch the trace directly
- Prefer Bun-native commands in this repository: `bun run check`, `bun test`, and `seal-use ...`. `npm run check` may work, but Bun is the project runtime and lockfile owner.
- Keep CLI entry points thin. Shared behavior belongs in `src/core` and `src/domains`; `src/cli.ts` should only handle command parsing, process lifecycle, and JSON output.
- Do not print diagnostic text to stdout from the MCP server. MCP uses stdout as the protocol stream; use stderr for server diagnostics.
- Keep the MCP exported surface to the `seal_cli` (read-only) and `seal_cli_write` (mutating) pair; command knowledge belongs in this skill and its focused references.
- Keep the MCP exported surface to the `seal_use_mcp` (read-only) and `seal_use_mcp_write` (mutating) pair; command knowledge belongs in this skill and its focused references.
- Prefer CLI or script processing for large tool responses. For daily approval questions, call `seal-use approval-runs summary --corp <corpId> ...` instead of reading long `approval-runs search` output manually.
- Keep broad search tools compact by default. Add explicit opt-in flags such as `includeBridge` for verbose fields that are useful only in deeper debugging.
- When Seal API timestamp filters are uncertain, filter again in tool code by `createdAt` and explicit timezone before presenting date-based answers.
+4 -4
View File
@@ -15,7 +15,7 @@ export async function handleAnalyticsCommand(
) {
if (action === "insight" || action === "insight-stats" || action === "stats") {
await runCapability(
"seal_insight_stats_get",
"sealInsightStatsGet",
client,
corp,
{
@@ -34,7 +34,7 @@ export async function handleAnalyticsCommand(
throw new Error("Usage: seal-use analytics risks <tagId> [--start-date <ISO>] [--end-date <ISO>] [--corp <corpId>]");
}
await runCapability(
"seal_insight_risks_by_tag_get",
"sealInsightRisksByTagGet",
client,
corp,
{
@@ -49,7 +49,7 @@ export async function handleAnalyticsCommand(
if (action === "performance" || action === "perf") {
await runCapability(
"seal_insight_performance_get",
"sealInsightPerformanceGet",
client,
corp,
{
@@ -67,7 +67,7 @@ export async function handleAnalyticsCommand(
throw new Error("Usage: seal-use analytics analyze <recordId> [--corp <corpId>]");
}
await runCapability(
"seal_insight_record_analyze",
"sealInsightRecordAnalyze",
client,
corp,
{
+14 -14
View File
@@ -26,7 +26,7 @@ export async function handleApprovalRunsCommand(
if (action === "summary") {
const result = await runCapabilityResult(
"seal_approval_runs_summary",
"sealApprovalRunsSummary",
client,
corp,
{
@@ -55,7 +55,7 @@ export async function handleApprovalRunsCommand(
if (action === "stats") {
const result = (await runCapabilityResult(
"seal_approval_runs_stats",
"sealApprovalRunsStats",
client,
corp,
{
@@ -87,7 +87,7 @@ export async function handleApprovalRunsCommand(
stringOption(args.options.endDate);
await runCapability(
"seal_approval_runs_count",
"sealApprovalRunsCount",
client,
corp,
{
@@ -105,7 +105,7 @@ export async function handleApprovalRunsCommand(
if (action === "search" || action === "list") {
await runCapability(
"seal_approval_runs_search",
"sealApprovalRunsSearch",
client,
corp,
{
@@ -134,7 +134,7 @@ export async function handleApprovalRunsCommand(
if (action === "bridge") {
await runCapability(
"seal_approval_run_langfuse_bridge_get",
"sealApprovalRunLangfuseBridgeGet",
client,
corp,
{
@@ -153,7 +153,7 @@ export async function handleApprovalRunsCommand(
const query = maybeName ?? stringOption(args.options.query) ?? stringOption(args.options.sn);
if (!query) throw new Error("Usage: seal-use approval-runs pick --sn <documentSN>");
await runCapability(
"seal_approval_run_pick",
"sealApprovalRunPick",
client,
corp,
{
@@ -175,7 +175,7 @@ export async function handleApprovalRunsCommand(
if (!recordId) throw new Error("Missing approval run recordId");
if (booleanOption(args.options.flow)) {
await runCapability(
"seal_approval_run_flow_get",
"sealApprovalRunFlowGet",
client,
corp,
{ recordId },
@@ -184,7 +184,7 @@ export async function handleApprovalRunsCommand(
return;
}
await runCapability(
"seal_approval_run_get",
"sealApprovalRunGet",
client,
corp,
{
@@ -200,14 +200,14 @@ export async function handleApprovalRunsCommand(
if (action === "cited-rules") {
const recordId = args.command[2];
if (!recordId) throw new Error("Usage: seal-use approval-runs cited-rules <recordId>");
await runCapability("seal_approval_run_cited_rules_get", client, corp, { recordId }, outputOptions(args.options));
await runCapability("sealApprovalRunCitedRulesGet", client, corp, { recordId }, outputOptions(args.options));
return;
}
if (action === "document-summary") {
const recordId = args.command[2];
if (!recordId) throw new Error("Usage: seal-use approval-runs document-summary <recordId>");
await runCapability("seal_approval_run_document_summary_get", client, corp, { recordId }, outputOptions(args.options));
await runCapability("sealApprovalRunDocumentSummaryGet", client, corp, { recordId }, outputOptions(args.options));
return;
}
@@ -218,7 +218,7 @@ export async function handleApprovalRunsCommand(
throw new Error("Usage: seal-use approval-runs diagnose <recordId>|--sn <documentSN> [--full] [--corp <corpId>]");
}
await runCapability(
"seal_approval_run_diagnose",
"sealApprovalRunDiagnose",
client,
corp,
{
@@ -317,7 +317,7 @@ export async function handleApprovalRunsCommand(
const recordId = args.command[2];
if (!recordId) throw new Error("Usage: seal-use approval-runs result <recordId> [--summary]");
await runCapability(
"seal_approval_run_result_get",
"sealApprovalRunResultGet",
client,
corp,
{
@@ -348,7 +348,7 @@ export async function handleApprovalRunsCommand(
}
await runCapability(
"seal_approval_run_url_get",
"sealApprovalRunUrlGet",
client,
corp,
{
@@ -377,7 +377,7 @@ export async function handleApprovalRunsCommand(
}
await runCapability(
"seal_approval_run_flow_get",
"sealApprovalRunFlowGet",
client,
corp,
{ target },
+3 -3
View File
@@ -78,20 +78,20 @@ export async function handleAuthCommand(action: string | undefined, corp: CorpCo
const client = await createSealClient(corp);
if (subAction === "list") {
await runCapability("seal_delegation_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealDelegationList", client, corp, {}, outputOptions(args.options));
return;
}
if (subAction === "revoke") {
const tokenId = args.command[3] ?? stringOption(args.options.tokenId) ?? stringOption(args.options.id);
if (!tokenId) throw new Error("Usage: seal-use auth link revoke <tokenId>");
await runCapability("seal_delegation_revoke", client, corp, { tokenId }, outputOptions(args.options));
await runCapability("sealDelegationRevoke", client, corp, { tokenId }, outputOptions(args.options));
return;
}
const note = stringOption(args.options.note) ?? "CLI generated provisional access link";
const delegation = await runCapabilityResult(
"seal_delegation_create",
"sealDelegationCreate",
client,
corp,
{ note }
+3 -3
View File
@@ -11,17 +11,17 @@ export async function handleBillingCommand(
args: ParsedArgs
) {
if (action === "status" || action === "get") {
await runCapability("seal_billing_status_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealBillingStatusGet", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "plans") {
await runCapability("seal_billing_plans_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealBillingPlansList", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "features") {
await runCapability("seal_billing_features_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealBillingFeaturesList", client, corp, {}, outputOptions(args.options));
return;
}
+5 -5
View File
@@ -12,29 +12,29 @@ export async function handleContactsCommand(
args: ParsedArgs
) {
if (action === "sync-time" || action === "last-sync-time") {
await runCapability("seal_contacts_last_sync_time_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealContactsLastSyncTimeGet", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "departments" || action === "department") {
if (!maybeName) {
await runCapability("seal_contacts_departments_root_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealContactsDepartmentsRootList", client, corp, {}, outputOptions(args.options));
return;
}
await runCapability("seal_contacts_department_get", client, corp, { departmentId: maybeName }, outputOptions(args.options));
await runCapability("sealContactsDepartmentGet", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
if (action === "children" || action === "department-children") {
if (!maybeName) throw new Error("Usage: seal-use contacts children <departmentId>");
await runCapability("seal_contacts_department_children_list", client, corp, { departmentId: maybeName }, outputOptions(args.options));
await runCapability("sealContactsDepartmentChildrenList", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
if (action === "users" || action === "department-users") {
if (!maybeName) throw new Error("Usage: seal-use contacts users <departmentId>");
await runCapability("seal_contacts_department_users_list", client, corp, { departmentId: maybeName }, outputOptions(args.options));
await runCapability("sealContactsDepartmentUsersList", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
+1 -1
View File
@@ -11,7 +11,7 @@ export async function handleContextCommand(
args: ParsedArgs
) {
await runCapability(
"seal_approval_context_get",
"sealApprovalContextGet",
client,
corp,
{
+2 -2
View File
@@ -20,12 +20,12 @@ export async function handleDataCommand(
};
if (action === "expenses" || action === "expense") {
await runCapability("seal_expenses_list", client, corp, params, outputOptions(args.options));
await runCapability("sealExpensesList", client, corp, params, outputOptions(args.options));
return;
}
if (action === "invoices" || action === "invoice") {
await runCapability("seal_invoices_list", client, corp, params, outputOptions(args.options));
await runCapability("sealInvoicesList", client, corp, params, outputOptions(args.options));
return;
}
+7 -7
View File
@@ -55,12 +55,12 @@ export async function handleDeployCommand(
}
if (action === "requirements") {
await runCapability("seal_deploy_hosecloud_requirements", client, corp, {}, outputOptions(args.options));
await runCapability("sealDeployHosecloudRequirements", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "list") {
await runCapability("seal_deploy_hosecloud_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealDeployHosecloudList", client, corp, {}, outputOptions(args.options));
return;
}
@@ -92,12 +92,12 @@ export async function handleDeployCommand(
: undefined
);
}
await runCapability("seal_deploy_hosecloud_get", client, corp, { signKey }, outputOptions(args.options));
await runCapability("sealDeployHosecloudGet", client, corp, { signKey }, outputOptions(args.options));
return;
}
if (action === "status") {
await runCapability("seal_deploy_hosecloud_status", client, corp, {}, outputOptions(args.options));
await runCapability("sealDeployHosecloudStatus", client, corp, {}, outputOptions(args.options));
return;
}
@@ -109,7 +109,7 @@ export async function handleDeployCommand(
if (!payload || Object.keys(payload).length === 0) {
throw new Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");
}
await runCapability("seal_deploy_hosecloud_configure", client, corp, {
await runCapability("sealDeployHosecloudConfigure", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
@@ -135,7 +135,7 @@ export async function handleDeployCommand(
if (firstHose && hoseConfigs.length === 1 && autoOpt) {
const singleKey = firstHose.signKey;
console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${singleKey})`);
await runCapability("seal_deploy_hosecloud_sync", client, corp, { signKey: singleKey }, outputOptions(args.options));
await runCapability("sealDeployHosecloudSync", client, corp, { signKey: singleKey }, outputOptions(args.options));
return;
}
@@ -162,7 +162,7 @@ export async function handleDeployCommand(
);
}
await runCapability("seal_deploy_hosecloud_sync", client, corp, { signKey }, outputOptions(args.options));
await runCapability("sealDeployHosecloudSync", client, corp, { signKey }, outputOptions(args.options));
return;
}
+6 -6
View File
@@ -39,7 +39,7 @@ export async function handleDocumentsCommand(
const limit = numberOption(args.options.limit);
const offset = numberOption(args.options.offset);
await runCapability(
"seal_approval_documents_list",
"sealApprovalDocumentsList",
client,
corp,
{ scenarios, limit, offset },
@@ -58,7 +58,7 @@ export async function handleDocumentsCommand(
throw new Error("Usage: seal-use documents get <documentId> [--corp <corpId>]");
}
await runCapability(
"seal_approval_document_get",
"sealApprovalDocumentGet",
client,
corp,
{ documentId },
@@ -73,7 +73,7 @@ export async function handleDocumentsCommand(
throw new Error("Usage: seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]");
}
await runCapability(
"seal_approval_search",
"sealApprovalSearch",
client,
corp,
{
@@ -121,7 +121,7 @@ export async function handleDocumentsCommand(
}
await runCapability(
"seal_approval_document_create",
"sealApprovalDocumentCreate",
client,
corp,
{
@@ -185,7 +185,7 @@ export async function handleDocumentsCommand(
}
await runCapability(
"seal_approval_document_update",
"sealApprovalDocumentUpdate",
client,
corp,
{
@@ -221,7 +221,7 @@ export async function handleDocumentsCommand(
);
}
await runCapability(
"seal_approval_delete_document",
"sealApprovalDeleteDocument",
client,
corp,
{ documentId },
+2 -2
View File
@@ -11,12 +11,12 @@ export async function handleLlmCommand(
args: ParsedArgs
) {
if (action === "config" || action === "get") {
await runCapability("seal_llm_config_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealLlmConfigGet", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "providers" || action === "list") {
await runCapability("seal_llm_providers_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealLlmProvidersList", client, corp, {}, outputOptions(args.options));
return;
}
+2 -2
View File
@@ -11,12 +11,12 @@ export async function handlePermissionsCommand(
args: ParsedArgs
) {
if (action === "available") {
await runCapability("seal_permissions_available_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealPermissionsAvailableList", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "configs" || action === "list") {
await runCapability("seal_permissions_configs_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealPermissionsConfigsList", client, corp, {}, outputOptions(args.options));
return;
}
+6 -6
View File
@@ -16,7 +16,7 @@ export async function handlePreferenceCommand(
args: ParsedArgs
) {
if (!action || action === "get") {
await runCapability("seal_preference_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealPreferenceGet", client, corp, {}, outputOptions(args.options));
return;
}
@@ -29,7 +29,7 @@ export async function handlePreferenceCommand(
if (!payload || Object.keys(payload).length === 0) {
throw new Error("Usage: seal-use preference decision update --json '{\"explicitApprove\":\"...\"}'");
}
await runCapability("seal_preference_decision_update", client, corp, {
await runCapability("sealPreferenceDecisionUpdate", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
@@ -46,7 +46,7 @@ export async function handlePreferenceCommand(
if (defaultLevel !== "medium" && defaultLevel !== "high") {
throw new Error("Usage: seal-use preference thinking-depth set --default <medium|high>");
}
await runCapability("seal_preference_thinking_depth_set", client, corp, {
await runCapability("sealPreferenceThinkingDepthSet", client, corp, {
defaultLevel,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
@@ -55,7 +55,7 @@ export async function handlePreferenceCommand(
if (subAction === "policies") {
if (thirdAction === "list" || !thirdAction) {
await runCapability("seal_preference_thinking_depth_policies_list", client, corp, {}, outputOptions(args.options));
await runCapability("sealPreferenceThinkingDepthPoliciesList", client, corp, {}, outputOptions(args.options));
return;
}
@@ -67,7 +67,7 @@ export async function handlePreferenceCommand(
if (!payload || !payload.id || !payload.name) {
throw new Error("Usage: seal-use preference thinking-depth policies upsert --json '{\"id\":\"...\",\"name\":\"...\",\"level\":\"high\"}'");
}
await runCapability("seal_preference_thinking_depth_policies_upsert", client, corp, {
await runCapability("sealPreferenceThinkingDepthPoliciesUpsert", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
@@ -79,7 +79,7 @@ export async function handlePreferenceCommand(
if (!policyId) {
throw new Error("Usage: seal-use preference thinking-depth policies remove <policyId>");
}
await runCapability("seal_preference_thinking_depth_policies_remove", client, corp, {
await runCapability("sealPreferenceThinkingDepthPoliciesRemove", client, corp, {
policyId,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
+17 -17
View File
@@ -62,14 +62,14 @@ export async function handleRulesCommand(
if (action === "count") {
const version = resolveVersionOption(args);
await runCapability("seal_approval_rules_list", client!, corp, { version, countOnly: true }, outputOptions(args.options));
await runCapability("sealApprovalRulesList", client!, corp, { version, countOnly: true }, outputOptions(args.options));
return;
}
if (action === "list") {
const version = resolveVersionOption(args);
if (booleanOption(args.options.count)) {
await runCapability("seal_approval_rules_list", client!, corp, { version, countOnly: true }, outputOptions(args.options));
await runCapability("sealApprovalRulesList", client!, corp, { version, countOnly: true }, outputOptions(args.options));
return;
}
@@ -77,7 +77,7 @@ export async function handleRulesCommand(
const offset = numberOption(args.options.offset);
if (booleanOption(args.options.summary)) {
await runCapability(
"seal_approval_rules_list",
"sealApprovalRulesList",
client!,
corp,
{
@@ -91,7 +91,7 @@ export async function handleRulesCommand(
return;
}
const result = await runCapabilityResult("seal_approval_rules_list", client!, corp, { version, limit, offset });
const result = await runCapabilityResult("sealApprovalRulesList", client!, corp, { version, limit, offset });
const output = outputOptions(args.options);
protectLargeRuleListOutput(result, output.allowFull === true || Boolean(output.outputFile));
printJson(result, output);
@@ -107,7 +107,7 @@ export async function handleRulesCommand(
`seal-use rules clear --corp ${corp.id} --dry-run`
);
}
const result = await runCapabilityResult("seal_approval_rules_clear", client!, corp, {
const result = await runCapabilityResult("sealApprovalRulesClear", client!, corp, {
dryRun,
recode: booleanOption(args.options.recode)
});
@@ -126,7 +126,7 @@ export async function handleRulesCommand(
}
if (action === "versions") {
await runCapability("seal_approval_rule_versions_list", client!, corp, {}, outputOptions(args.options));
await runCapability("sealApprovalRuleVersionsList", client!, corp, {}, outputOptions(args.options));
return;
}
@@ -134,7 +134,7 @@ export async function handleRulesCommand(
const version = resolveVersionOption(args, maybeName);
if (!version) throw new Error("Usage: seal-use rules version <versionNumber|latest>");
await runCapability(
"seal_approval_rule_version_get",
"sealApprovalRuleVersionGet",
client!,
corp,
parseRuleVersionSelector(version),
@@ -151,7 +151,7 @@ export async function handleRulesCommand(
}
const singleSelector = args.command[4];
await runCapability(
"seal_approval_rule_version_diff",
"sealApprovalRuleVersionDiff",
client!,
corp,
{
@@ -180,7 +180,7 @@ export async function handleRulesCommand(
throw new Error("Usage: seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]");
}
await runCapability(
"seal_approval_rule_get",
"sealApprovalRuleGet",
client!,
corp,
{
@@ -204,7 +204,7 @@ export async function handleRulesCommand(
throw new Error("Usage: seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]");
}
await runCapability(
"seal_approval_rule_create",
"sealApprovalRuleCreate",
client!,
corp,
{ description, scope, strictness },
@@ -230,7 +230,7 @@ export async function handleRulesCommand(
throw new Error("Usage: seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]");
}
await runCapability(
"seal_approval_rule_update",
"sealApprovalRuleUpdate",
client!,
corp,
{ ruleId, description, scope, strictness },
@@ -256,7 +256,7 @@ export async function handleRulesCommand(
);
}
await runCapability(
"seal_approval_rule_delete",
"sealApprovalRuleDelete",
client!,
corp,
{ ruleId },
@@ -277,7 +277,7 @@ export async function handleRulesCommand(
throw new Error("Usage: seal-use rules publish <versionName> [--corp <corpId>]");
}
await runCapability(
"seal_approval_rule_version_publish",
"sealApprovalRuleVersionPublish",
client!,
corp,
{ versionName },
@@ -290,7 +290,7 @@ export async function handleRulesCommand(
const keyword = maybeName ?? stringOption(args.options.query);
if (!keyword) throw new Error("Usage: seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]");
await runCapability(
"seal_approval_search",
"sealApprovalSearch",
client!,
corp,
{
@@ -313,7 +313,7 @@ export async function handleRulesCommand(
const version = resolveVersionOption(args, maybeName);
const out = stringOption(args.options.out) ?? stringOption(args.options.file) ?? stringOption(args.options.f);
await runCapability(
"seal_approval_rules_pull",
"sealApprovalRulesPull",
client!,
corp,
{
@@ -340,7 +340,7 @@ export async function handleRulesCommand(
}
const result = await runCapabilityResult(
"seal_approval_rules_push",
"sealApprovalRulesPush",
client!,
corp,
{
@@ -368,7 +368,7 @@ export async function handleRulesCommand(
if (action === "lint") {
await runCapability(
"seal_approval_rules_lint",
"sealApprovalRulesLint",
client as Awaited<ReturnType<typeof createSealClient>>,
corp,
{
+13 -13
View File
@@ -24,7 +24,7 @@ export async function handleSimulationCommand(
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation batch-records <batchId>");
await runCapability(
"seal_simulation_batch_records_get",
"sealSimulationBatchRecordsGet",
client,
corp,
{
@@ -67,7 +67,7 @@ export async function handleSimulationCommand(
const noWait = booleanOption(args.options.noWait) ?? booleanOption(args.options["no-wait"]) ?? (wait ? false : true);
const result = await runCapabilityResult(
"seal_simulation_batch_create",
"sealSimulationBatchCreate",
client,
corp,
{
@@ -103,7 +103,7 @@ export async function handleSimulationCommand(
if (wait && result && typeof result === "object" && "batchId" in result && typeof result.batchId === "string") {
await runCapability(
"seal_simulation_batch_wait",
"sealSimulationBatchWait",
client,
corp,
{
@@ -124,7 +124,7 @@ export async function handleSimulationCommand(
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");
await runCapability(
"seal_simulation_batch_wait",
"sealSimulationBatchWait",
client,
corp,
{
@@ -141,7 +141,7 @@ export async function handleSimulationCommand(
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation status <batchId>");
await runCapability(
"seal_simulation_batch_status",
"sealSimulationBatchStatus",
client,
corp,
{ batchId },
@@ -160,7 +160,7 @@ export async function handleSimulationCommand(
`seal-use simulation clean ${batchId} --corp ${corp.id} --yes`
);
}
await runCapability("seal_simulation_batch_clean", client, corp, { batchId }, outputOptions(args.options));
await runCapability("sealSimulationBatchClean", client, corp, { batchId }, outputOptions(args.options));
return;
}
@@ -170,13 +170,13 @@ export async function handleSimulationCommand(
stringOption(args.options.integration) ??
stringOption(args.options.signKey) ??
stringOption(args.options["sign-key"]);
await runCapability("seal_simulation_specifications_list", client, corp, { signKey }, outputOptions(args.options));
await runCapability("sealSimulationSpecificationsList", client, corp, { signKey }, outputOptions(args.options));
return;
}
if (action === "approval-definitions" || action === "definitions") {
await runCapability(
"seal_simulation_feishu_approval_definitions_list",
"sealSimulationFeishuApprovalDefinitionsList",
client,
corp,
{},
@@ -187,7 +187,7 @@ export async function handleSimulationCommand(
if (action === "list") {
await runCapability(
"seal_simulation_batches_list",
"sealSimulationBatchesList",
client,
corp,
{
@@ -201,17 +201,17 @@ export async function handleSimulationCommand(
if (action === "get") {
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation get <batchId>");
await runCapability("seal_simulation_batch_get", client, corp, { batchId }, outputOptions(args.options));
await runCapability("sealSimulationBatchGet", client, corp, { batchId }, outputOptions(args.options));
return;
}
if (action === "templates") {
await runCapability("seal_simulation_templates_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealSimulationTemplatesGet", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "integrations") {
await runCapability("seal_simulation_integrations_get", client, corp, {}, outputOptions(args.options));
await runCapability("sealSimulationIntegrationsGet", client, corp, {}, outputOptions(args.options));
return;
}
@@ -219,7 +219,7 @@ export async function handleSimulationCommand(
const filePath = maybeName ?? stringOption(args.options.file);
if (!filePath) throw new Error("Usage: seal-use simulation package-upload <材料包.zip>");
if (!existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
await runCapability("seal_simulation_material_package_upload", client, corp, { filePath }, outputOptions(args.options));
await runCapability("sealSimulationMaterialPackageUpload", client, corp, { filePath }, outputOptions(args.options));
return;
}
+7 -7
View File
@@ -19,7 +19,7 @@ export async function handleUsersCommand(
if (!name || !phone) throw new Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");
const deptId = stringOption(args.options.dept) ?? stringOption(args.options.departmentId);
const departmentIds = deptId ? [deptId] : undefined;
await runCapability("seal_user_create", client, corp, { name, phone, departmentIds }, outputOptions(args.options));
await runCapability("sealUserCreate", client, corp, { name, phone, departmentIds }, outputOptions(args.options));
return;
}
@@ -33,20 +33,20 @@ export async function handleUsersCommand(
`seal-use users reset-password ${userId} --corp ${corp.id} --yes`
);
}
await runCapability("seal_user_reset_password", client, corp, { userId }, outputOptions(args.options));
await runCapability("sealUserResetPassword", client, corp, { userId }, outputOptions(args.options));
return;
}
if (action === "search" || action === "list") {
const keyword = maybeName ?? stringOption(args.options.keyword) ?? stringOption(args.options.query) ?? "";
await runCapability("seal_user_search", client, corp, { keyword }, outputOptions(args.options));
await runCapability("sealUserSearch", client, corp, { keyword }, outputOptions(args.options));
return;
}
if (action === "get") {
const userId = maybeName ?? stringOption(args.options.userId);
if (!userId) throw new Error("Usage: seal-use users get <userId>");
await runCapability("seal_user_get", client, corp, { userId }, outputOptions(args.options));
await runCapability("sealUserGet", client, corp, { userId }, outputOptions(args.options));
return;
}
@@ -60,14 +60,14 @@ export async function handleUsersCommand(
`seal-use users delete ${userId} --corp ${corp.id} --yes`
);
}
await runCapability("seal_user_delete", client, corp, { userId }, outputOptions(args.options));
await runCapability("sealUserDelete", client, corp, { userId }, outputOptions(args.options));
return;
}
if (action === "activate") {
const userId = maybeName ?? stringOption(args.options.userId);
if (!userId) throw new Error("Usage: seal-use users activate <userId>");
await runCapability("seal_user_activate", client, corp, { userId }, outputOptions(args.options));
await runCapability("sealUserActivate", client, corp, { userId }, outputOptions(args.options));
return;
}
@@ -75,7 +75,7 @@ export async function handleUsersCommand(
const userIdOrPhone = maybeName ?? stringOption(args.options.userId) ?? stringOption(args.options.phone);
if (!userIdOrPhone) throw new Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");
const note = stringOption(args.options.note);
await runCapability("seal_user_delegation_create", client, corp, { userIdOrPhone, note }, outputOptions(args.options));
await runCapability("sealUserDelegationCreate", client, corp, { userIdOrPhone, note }, outputOptions(args.options));
return;
}
+5 -5
View File
@@ -316,7 +316,7 @@ export async function handleWebhookCommand(
}
if (action === "list") {
await runCapability(
"seal_webhook_list",
"sealWebhookList",
client,
corp,
{
@@ -332,7 +332,7 @@ export async function handleWebhookCommand(
const selector = maybeName ?? stringOption(args.options.selector) ?? stringOption(args.options.id);
if (!selector) throw new Error("Usage: seal-use webhook get <idOrName> [--show-secret]");
await runCapability(
"seal_webhook_get",
"sealWebhookGet",
client,
corp,
{
@@ -358,7 +358,7 @@ export async function handleWebhookCommand(
const materialPackFilePolicy = materialPackFilePolicyOptions(args.options);
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
await runCapability(
"seal_webhook_add",
"sealWebhookAdd",
client,
corp,
{
@@ -406,7 +406,7 @@ export async function handleWebhookCommand(
throw usageError("Webhook update requires at least one field option");
}
await runCapability(
"seal_webhook_update",
"sealWebhookUpdate",
client,
corp,
{
@@ -436,7 +436,7 @@ export async function handleWebhookCommand(
);
}
await runCapability(
"seal_webhook_delete",
"sealWebhookDelete",
client,
corp,
{
+2 -2
View File
@@ -96,7 +96,7 @@ describe("CLI read-only classification", () => {
["update"],
["auth", "keys"],
["analytics", "analyze", "record-1"],
["tool", "seal_approval_rule_create", "--json", "{}"],
["tool", "sealApprovalRuleCreate", "--json", "{}"],
["totally-unknown", "list"],
[]
]) {
@@ -152,7 +152,7 @@ describe("CLI allow-list agrees with the tool registry", () => {
for (const file of files) {
const area = file.replace(/\.ts$/, "");
const source = readFileSync(join(import.meta.dir, "commands", file), "utf8");
const pattern = /action === "([a-z0-9-]+)"[\s\S]{0,600}?runCapability\(\s*"(seal_[a-z_0-9]+)"/g;
const pattern = /action === "([a-z0-9-]+)"[\s\S]{0,600}?runCapability\(\s*"(seal[A-Z][A-Za-z0-9]*)"/g;
let match;
while ((match = pattern.exec(source))) {
pairs.push({ area, action: match[1]!, tool: match[2]! });
+2 -2
View File
@@ -9,8 +9,8 @@ import {
TokenStoreSchema
} from "./types.js";
const PRIMARY_TOKEN_STORE = join(homedir(), ".config", "seal-use", "seal_tokens.json");
const LEGACY_TOKEN_STORE = join(homedir(), ".config", "seal-home", "seal_tokens.json");
const PRIMARY_TOKEN_STORE = join(homedir(), ".config", "seal-use", "sealTokens.json");
const LEGACY_TOKEN_STORE = join(homedir(), ".config", "seal-home", "sealTokens.json");
function resolveReadStorePath(): string {
const configured = (process.env.SEAL_USE_TOKEN_STORE ?? process.env.SEAL_HOME_TOKEN_STORE)?.trim();
+1 -1
View File
@@ -114,7 +114,7 @@ export function diagnoseSystem(): DoctorDiagnosis {
const configDir = join(home, ".config", "seal-use");
const enterprisesDir = join(configDir, "enterprises");
const globalConfigFile = join(configDir, "config.json");
const tokenStore = join(configDir, "seal_tokens.json");
const tokenStore = join(configDir, "sealTokens.json");
const mappingsDir = join(configDir, "mappings");
const agentSkillDir = getDefaultGlobalSkillDir();
const exportDir = join(home, "Downloads");
+1 -1
View File
@@ -55,7 +55,7 @@ export const EMBEDDED_DIRECTORY_SPECS: DirectorySpec[] = [
{
name: "会话凭据安全缓存",
category: "config",
standardPath: "~/.config/seal-use/seal_tokens.json",
standardPath: "~/.config/seal-use/sealTokens.json",
purpose: "缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",
accessMode: "read-write",
retention: "cache"
+1 -1
View File
@@ -66,7 +66,7 @@ function saveUsageStatsAtomic(stats: CorpUsageStats, targetPath: string = resolv
}
const tempPath = `${targetPath}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2, 8)}.tmp`;
try {
// 0o600 like `seal_tokens.json`: usage rows name the enterprises this machine has been
// 0o600 like `sealTokens.json`: usage rows name the enterprises this machine has been
// operating, so keep them owner-only instead of inheriting the 0o644 default.
writeFileSync(tempPath, JSON.stringify(stats, null, 2), { encoding: "utf-8", mode: 0o600 });
renameSync(tempPath, targetPath);
+102 -102
View File
@@ -32,7 +32,7 @@ afterEach(() => {
describe("sealCapabilities", () => {
test("exposes concrete JSON schemas for parameterized tools", () => {
const createRule = sealCapabilities.find((tool) => tool.name === "seal_approval_rule_create");
const createRule = sealCapabilities.find((tool) => tool.name === "sealApprovalRuleCreate");
expect(createRule).toBeDefined();
const schema = z.toJSONSchema(createRule!.parameters) as {
@@ -49,19 +49,19 @@ describe("sealCapabilities", () => {
});
test("includes the approval context aggregation tool", () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_context_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalContextGet");
expect(tool).toBeDefined();
});
test("includes the session diagnostic tool", () => {
const tool = sealCapabilities.find((item) => item.name === "seal_session_get");
const tool = sealCapabilities.find((item) => item.name === "sealSessionGet");
expect(tool).toBeDefined();
});
test("includes the delegation management tools", () => {
const listTool = sealCapabilities.find((item) => item.name === "seal_delegation_list");
const createCapability = sealCapabilities.find((item) => item.name === "seal_delegation_create");
const revokeTool = sealCapabilities.find((item) => item.name === "seal_delegation_revoke");
const listTool = sealCapabilities.find((item) => item.name === "sealDelegationList");
const createCapability = sealCapabilities.find((item) => item.name === "sealDelegationCreate");
const revokeTool = sealCapabilities.find((item) => item.name === "sealDelegationRevoke");
expect(listTool).toBeDefined();
expect(createCapability).toBeDefined();
@@ -69,13 +69,13 @@ describe("sealCapabilities", () => {
});
test("includes user management tools", () => {
const createCapability = sealCapabilities.find((item) => item.name === "seal_user_create");
const resetTool = sealCapabilities.find((item) => item.name === "seal_user_reset_password");
const getTool = sealCapabilities.find((item) => item.name === "seal_user_get");
const searchTool = sealCapabilities.find((item) => item.name === "seal_user_search");
const deleteTool = sealCapabilities.find((item) => item.name === "seal_user_delete");
const activateTool = sealCapabilities.find((item) => item.name === "seal_user_activate");
const userDelegationTool = sealCapabilities.find((item) => item.name === "seal_user_delegation_create");
const createCapability = sealCapabilities.find((item) => item.name === "sealUserCreate");
const resetTool = sealCapabilities.find((item) => item.name === "sealUserResetPassword");
const getTool = sealCapabilities.find((item) => item.name === "sealUserGet");
const searchTool = sealCapabilities.find((item) => item.name === "sealUserSearch");
const deleteTool = sealCapabilities.find((item) => item.name === "sealUserDelete");
const activateTool = sealCapabilities.find((item) => item.name === "sealUserActivate");
const userDelegationTool = sealCapabilities.find((item) => item.name === "sealUserDelegationCreate");
expect(createCapability).toBeDefined();
expect(resetTool).toBeDefined();
@@ -87,82 +87,82 @@ describe("sealCapabilities", () => {
});
test("includes read-only contacts directory tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_contacts_departments_root_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_contacts_department_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_contacts_department_children_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_contacts_department_users_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_contacts_last_sync_time_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealContactsDepartmentsRootList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealContactsDepartmentGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealContactsDepartmentChildrenList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealContactsDepartmentUsersList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealContactsLastSyncTimeGet")).toBeDefined();
});
test("includes the read-only insight stats and analytics tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_insight_stats_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_insight_risks_by_tag_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_insight_performance_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_insight_record_analyze")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_insight_export")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInsightStatsGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInsightRisksByTagGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInsightPerformanceGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInsightRecordAnalyze")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInsightExport")).toBeDefined();
});
test("includes read-only financial data tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_expenses_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_invoices_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealExpensesList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealInvoicesList")).toBeDefined();
});
test("includes the Feishu simulation approval definition tool", () => {
expect(sealCapabilities.find((item) => item.name === "seal_simulation_feishu_approval_definitions_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationFeishuApprovalDefinitionsList")).toBeDefined();
});
test("includes system configuration tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_llm_config_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_llm_providers_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_permissions_available_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_permissions_configs_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_billing_status_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_billing_plans_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_billing_features_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealLlmConfigGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealLlmProvidersList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPermissionsAvailableList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPermissionsConfigsList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealBillingStatusGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealBillingPlansList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealBillingFeaturesList")).toBeDefined();
});
test("includes Webhook management tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_webhook_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_webhook_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_webhook_add")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_webhook_update")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_webhook_delete")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_webhook_replay")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookAdd")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookUpdate")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookDelete")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealWebhookReplay")).toBeDefined();
});
test("includes deploy hosecloud tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_requirements")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_status")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_configure")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_sync")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudRequirements")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudStatus")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudConfigure")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealDeployHosecloudSync")).toBeDefined();
});
test("includes preference and thinking-depth tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_preference_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_preference_decision_update")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_preference_thinking_depth_set")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_preference_thinking_depth_policies_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_preference_thinking_depth_policies_upsert")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_preference_thinking_depth_policies_remove")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceDecisionUpdate")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceThinkingDepthSet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceThinkingDepthPoliciesList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceThinkingDepthPoliciesUpsert")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealPreferenceThinkingDepthPoliciesRemove")).toBeDefined();
});
test("includes simulation wait, clean, specifications tools and approval run stats/count", () => {
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_wait")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_clean")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_specifications_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_approval_runs_stats")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_approval_runs_count")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchWait")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchClean")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationSpecificationsList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealApprovalRunsStats")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealApprovalRunsCount")).toBeDefined();
});
test("includes the approval search tool", () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_search");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalSearch");
expect(tool).toBeDefined();
});
test("approval rules list can return count only", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_list");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesList");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -172,7 +172,7 @@ describe("sealCapabilities", () => {
});
test("approval rules list treats limit zero as count only", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_list");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesList");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -182,7 +182,7 @@ describe("sealCapabilities", () => {
});
test("approval rules list can project lightweight fields", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_list");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesList");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -206,7 +206,7 @@ describe("sealCapabilities", () => {
});
test("approval rules list renders timestamps in standard Beijing ISO format", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_list");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesList");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -255,7 +255,7 @@ describe("sealCapabilities", () => {
}]
});
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
const context = { corp: { ...fakeContext().corp, testCorpId: "t-corp-1" } };
@@ -274,7 +274,7 @@ describe("sealCapabilities", () => {
});
test("approval rule update without --if-unchanged leaves concurrency check absent", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_update");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleUpdate");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
const result = await handler(
@@ -286,7 +286,7 @@ describe("sealCapabilities", () => {
});
test("approval rule update --if-unchanged rejects when the draft moved on (exit 13)", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_update");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleUpdate");
const handler = tool!.handler as CapabilityHandler;
try {
await handler(
@@ -302,7 +302,7 @@ describe("sealCapabilities", () => {
});
test("approval rule update --if-unchanged proceeds when the draft is unchanged", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_update");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleUpdate");
const handler = tool!.handler as CapabilityHandler;
const result = await handler(
fakeRuleUpdateClient(1780898164536),
@@ -312,8 +312,8 @@ describe("sealCapabilities", () => {
expect(result).toMatchObject({ id: "rule-1" });
});
test("seal_approval_run_diagnose aggregates document, result, cited rules, and version snapshot", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_diagnose");
test("sealApprovalRunDiagnose aggregates document, result, cited rules, and version snapshot", async () => {
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunDiagnose");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -339,7 +339,7 @@ describe("sealCapabilities", () => {
});
test("approval rules clear can dry run without deleting", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_clear");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesClear");
expect(tool).toBeDefined();
const client = fakeClearRulesClient();
@@ -361,7 +361,7 @@ describe("sealCapabilities", () => {
});
test("approval rules clear deletes all draft rules", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rules_clear");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRulesClear");
expect(tool).toBeDefined();
const client = fakeClearRulesClient();
@@ -385,7 +385,7 @@ describe("sealCapabilities", () => {
});
test("preference dry run reads config without patching it", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_preference_decision_update");
const tool = sealCapabilities.find((item) => item.name === "sealPreferenceDecisionUpdate");
expect(tool).toBeDefined();
let patched = false;
const client = {
@@ -503,19 +503,19 @@ describe("sealCapabilities", () => {
});
test("includes approval run Langfuse bridge tools", () => {
expect(sealCapabilities.find((item) => item.name === "seal_approval_runs_search")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_approval_runs_summary")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_records_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_approval_run_langfuse_bridge_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealApprovalRunsSearch")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealApprovalRunsSummary")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchRecordsGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealApprovalRunLangfuseBridgeGet")).toBeDefined();
});
test("can find tools by name in sealCapabilities", () => {
expect(findSealCapability("seal_approval_rule_create")).toBeDefined();
expect(findSealCapability("sealApprovalRuleCreate")).toBeDefined();
expect(findSealCapability("non_existent_tool")).toBeUndefined();
});
test("approval run search omits bridge unless requested", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_search");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsSearch");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -526,7 +526,7 @@ describe("sealCapabilities", () => {
});
test("approval run search can filter by extracted human result", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_search");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsSearch");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -551,7 +551,7 @@ describe("sealCapabilities", () => {
});
test("approval run search maps rejected human result to manual approval status", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_search");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsSearch");
expect(tool).toBeDefined();
const requests: string[] = [];
@@ -573,7 +573,7 @@ describe("sealCapabilities", () => {
});
test("approval run search forwards query as API search parameter", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_search");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsSearch");
expect(tool).toBeDefined();
const requests: string[] = [];
@@ -595,7 +595,7 @@ describe("sealCapabilities", () => {
});
test("approval run get returns stable aliases for document concepts", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -627,7 +627,7 @@ describe("sealCapabilities", () => {
});
test("approval run get can return selected fields only", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -650,7 +650,7 @@ describe("sealCapabilities", () => {
});
test("approval run get can return summary preset", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -666,7 +666,7 @@ describe("sealCapabilities", () => {
});
test("approval run pick supports sn latest and compact candidate fields", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_pick");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunPick");
expect(tool).toBeDefined();
const requests: string[] = [];
@@ -687,7 +687,7 @@ describe("sealCapabilities", () => {
});
test("approval run attachments extracts compact attachment metadata", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_attachments_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunAttachmentsGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -713,7 +713,7 @@ describe("sealCapabilities", () => {
});
test("approval run cited rules extracts rule application details", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_cited_rules_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunCitedRulesGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -736,7 +736,7 @@ describe("sealCapabilities", () => {
});
test("approval run document summary returns key fields without raw payload", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_document_summary_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunDocumentSummaryGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -756,7 +756,7 @@ describe("sealCapabilities", () => {
});
test("approval run result can return summary only", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_result_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunResultGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -782,7 +782,7 @@ describe("sealCapabilities", () => {
});
test("approval run url returns Seal result and Hose document links by recordId", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -822,7 +822,7 @@ describe("sealCapabilities", () => {
});
test("approval run url supports type=hose-document", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -846,7 +846,7 @@ describe("sealCapabilities", () => {
});
test("approval run url throws error without a document lookup", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
const requests: string[] = [];
@@ -862,7 +862,7 @@ describe("sealCapabilities", () => {
});
test("approval run url can resolve by sourceDocumentSN", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
primeHoseEnterpriseUrl("corp-a", "https://app.ekuaibao.com/web/home.html?accessToken=close-token");
@@ -883,7 +883,7 @@ describe("sealCapabilities", () => {
});
test("approval run url returns auto_login link with identity, expiration, and warning when autoLogin=true", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
primeHoseEnterpriseUrl("corp-a", "https://app.ekuaibao.com/web/home.html?accessToken=close-token");
@@ -912,7 +912,7 @@ describe("sealCapabilities", () => {
});
test("approval run url supports legacy hoseSso=true with explicit hose attribute naming", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
primeHoseEnterpriseUrl("corp-a", "https://app.ekuaibao.com/web/home.html?accessToken=close-token");
@@ -937,7 +937,7 @@ describe("sealCapabilities", () => {
});
test("approval run url throws clear error when sso=true is used on non-hose enterprise", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_url_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunUrlGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -951,7 +951,7 @@ describe("sealCapabilities", () => {
});
test("approval run summary filters by local date and returns compact aggregates", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_summary");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsSummary");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -977,7 +977,7 @@ describe("sealCapabilities", () => {
});
test("approval rule get resolves one rule by version and code", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -998,7 +998,7 @@ describe("sealCapabilities", () => {
});
test("approval rule get defaults to current draft and handles 0-based codes without +1 offset", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_rule_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRuleGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
const client = fakeZeroBasedRulesClient();
@@ -1049,7 +1049,7 @@ describe("sealCapabilities", () => {
});
test("approval run cited-rules extracts and merges result.rulesResult and result.hitRules", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_run_cited_rules_get");
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunCitedRulesGet");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -1124,7 +1124,7 @@ describe("sealCapabilities", () => {
});
test("deploy hosecloud configure saves integration and rejects missing customApiUrl", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_configure");
const tool = sealCapabilities.find((item) => item.name === "sealDeployHosecloudConfigure");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -1165,7 +1165,7 @@ describe("sealCapabilities", () => {
});
test("deploy hosecloud status masks signKey alongside apiKey/apiSecret", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_deploy_hosecloud_status");
const tool = sealCapabilities.find((item) => item.name === "sealDeployHosecloudStatus");
expect(tool).toBeDefined();
const handler = tool!.handler as CapabilityHandler;
@@ -1207,8 +1207,8 @@ describe("sealCapabilities", () => {
expect(JSON.stringify(result)).not.toContain("visible-sign-key-123");
});
test("seal_approval_runs_count supports startDate and endDate and normalizes them", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_approval_runs_count");
test("sealApprovalRunsCount supports startDate and endDate and normalizes them", async () => {
const tool = sealCapabilities.find((item) => item.name === "sealApprovalRunsCount");
expect(tool).toBeDefined();
const schema = z.toJSONSchema(tool!.parameters) as {
+15 -15
View File
@@ -47,7 +47,7 @@ const {
export const approvalRunsCapabilities = [
{
name: "seal_approval_runs_search",
name: "sealApprovalRunsSearch",
description: "查询 Seal 审批/审核运行记录总表,并整理合思单据到 Langfuse trace/session 的桥接字段",
parameters: z.object({
offset: z.number().int().nonnegative().optional(),
@@ -103,7 +103,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_runs_summary",
name: "sealApprovalRunsSummary",
description: "按本地日期/时区汇总 Seal 审批运行记录,返回状态、模式统计和精简记录,避免长 JSON 输出",
parameters: z.object({
date: z.string().optional().describe("本地日期,格式 YYYY-MM-DD;默认使用 timezone 下的今天"),
@@ -170,7 +170,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_runs_export",
name: "sealApprovalRunsExport",
description: "将企业的审批审核记录导出为高保真 Excel 报表(包含单据模板、AI决策、人工审核结论、驳回原因及企业规则列细分结果)",
parameters: z.object({
startDate: z.string().optional().describe("起始时间,支持 YYYY-MM-DD 或毫秒时间戳"),
@@ -198,7 +198,7 @@ export const approvalRunsCapabilities = [
) => exportApprovalRunsToExcel(client, context.corp, params)
},
{
name: "seal_approval_run_get",
name: "sealApprovalRunGet",
description: "获取 Seal 单条审批/审核运行记录详情;可用 fields 只取 metadata、document.fields、result.summary 等局部字段",
parameters: z.object({
recordId: z.string().describe("Seal approval run record ID"),
@@ -221,7 +221,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_flow_get",
name: "sealApprovalRunFlowGet",
description: "获取合思原生审批流流转时间线、待办节点、员工意见、驳回原因及版本变更指标,并对齐 AI 运行记录与人工行为",
parameters: z.object({
target: z.string().optional().describe("合思单号 (sourceDocumentSN) 或 Seal 运行记录 ID (recordId)"),
@@ -370,7 +370,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_cited_rules_get",
name: "sealApprovalRunCitedRulesGet",
description: "从审批运行结果中抽取 AI 引用或命中的规则及应用分析",
parameters: z.object({
recordId: z.string().describe("Seal approval run record ID")
@@ -384,7 +384,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_document_summary_get",
name: "sealApprovalRunDocumentSummaryGet",
description: "返回单据关键字段、附件摘要、AI/人工结果,避免拉取完整原始单据",
parameters: z.object({
recordId: z.string().describe("Seal approval run record ID")
@@ -398,7 +398,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_attachments_get",
name: "sealApprovalRunAttachmentsGet",
description: "从审批运行记录中抽取附件、发票附件和字段位置,不返回完整单据正文和规则结果",
parameters: z.object({
recordId: z.string().describe("Seal approval run record ID"),
@@ -413,7 +413,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_result_get",
name: "sealApprovalRunResultGet",
description: "返回审批运行结果摘要;summary=true 时只返回 decision、summary、风险点数量、命中规则数量、traceId 等",
parameters: z.object({
recordId: z.string().describe("Seal approval run record ID"),
@@ -432,7 +432,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_url_get",
name: "sealApprovalRunUrlGet",
description: "获取审批单的 Web 链接(支持 seal-result 审核页与 hose-document 原单据页,支持 --auto-login 免密直达)",
parameters: z.object({
recordId: z.string().optional().describe("Seal approval run record ID"),
@@ -555,7 +555,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_pick",
name: "sealApprovalRunPick",
description: "按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",
parameters: z.object({
query: z.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),
@@ -619,7 +619,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_diagnose",
name: "sealApprovalRunDiagnose",
description: "一键客诉/单据诊断:按单号 SN 或 recordId 一次聚合单据摘要、AI 判定结果、引用规则、当时的规则版本快照与 Langfuse trace 指针,替代串行调用 pick/get/cited-rules/rules version",
parameters: z.object({
sn: z.string().optional().describe("合思/易快报单号 (sourceDocumentSN);与 recordId 二选一"),
@@ -710,7 +710,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_run_langfuse_bridge_get",
name: "sealApprovalRunLangfuseBridgeGet",
description: "从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",
parameters: z.object({
recordId: z.string().optional(),
@@ -754,7 +754,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_runs_stats",
name: "sealApprovalRunsStats",
description: "统计审核记录状态分布、来源系统分布及按单号/ID去重统计",
parameters: z.object({
since: z.string().optional().describe("时间范围,如 3months, 7days, 24hours"),
@@ -802,7 +802,7 @@ export const approvalRunsCapabilities = [
}
},
{
name: "seal_approval_runs_count",
name: "sealApprovalRunsCount",
description: "统计符合条件的审核记录总数",
parameters: z.object({
status: z.string().optional(),
+7 -7
View File
@@ -4,43 +4,43 @@ import * as api from "../api.js";
export const billingCapabilities = [
{
name: "seal_llm_config_get",
name: "sealLlmConfigGet",
description: "查询当前 Seal 租户的大模型 (LLM) 配置",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getLlmConfig(client)
},
{
name: "seal_llm_providers_list",
name: "sealLlmProvidersList",
description: "查询支持的大模型 (LLM) 供应商与配置属性字段",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listLlmProviders(client)
},
{
name: "seal_permissions_available_list",
name: "sealPermissionsAvailableList",
description: "查询系统可选权限清单(如超级管理员、智能审核管理、数据管理等)",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listAvailablePermissions(client)
},
{
name: "seal_permissions_configs_list",
name: "sealPermissionsConfigsList",
description: "查询当前租户已绑定的权限配置",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listPermissionConfigs(client)
},
{
name: "seal_billing_status_get",
name: "sealBillingStatusGet",
description: "查询当前 Seal 租户的订阅状态与各功能额度(AI审批、审核规则、知识文档等)",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getBillingStatus(client)
},
{
name: "seal_billing_plans_list",
name: "sealBillingPlansList",
description: "查询系统支持的订阅套餐列表",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listBillingPlans(client)
},
{
name: "seal_billing_features_list",
name: "sealBillingFeaturesList",
description: "查询系统支持的功能特性定义列表",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listBillingFeatures(client)
+5 -5
View File
@@ -4,13 +4,13 @@ import * as api from "../api.js";
export const contactsCapabilities = [
{
name: "seal_contacts_departments_root_list",
name: "sealContactsDepartmentsRootList",
description: "列出当前 Seal 租户通讯录的顶级部门",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listRootDepartments(client)
},
{
name: "seal_contacts_department_get",
name: "sealContactsDepartmentGet",
description: "获取指定通讯录部门的详细信息",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
@@ -19,7 +19,7 @@ export const contactsCapabilities = [
api.getDepartment(client, params.departmentId)
},
{
name: "seal_contacts_department_children_list",
name: "sealContactsDepartmentChildrenList",
description: "列出指定通讯录部门的直接子部门",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
@@ -28,7 +28,7 @@ export const contactsCapabilities = [
api.listDepartmentChildren(client, params.departmentId)
},
{
name: "seal_contacts_department_users_list",
name: "sealContactsDepartmentUsersList",
description: "列出指定通讯录部门下的用户",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
@@ -37,7 +37,7 @@ export const contactsCapabilities = [
api.listDepartmentUsers(client, params.departmentId)
},
{
name: "seal_contacts_last_sync_time_get",
name: "sealContactsLastSyncTimeGet",
description: "查询通讯录最后同步时间",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getContactsLastSyncTime(client)
+6 -6
View File
@@ -18,7 +18,7 @@ const {
export const deployCapabilities = [
{
name: "seal_deploy_hosecloud_requirements",
name: "sealDeployHosecloudRequirements",
description: "获取 Seal AI 审批发布到合思费控所需配置字段与说明",
parameters: z.object({}),
handler: async () => {
@@ -39,7 +39,7 @@ export const deployCapabilities = [
}
},
{
name: "seal_deploy_hosecloud_list",
name: "sealDeployHosecloudList",
description: "列出当前企业【Seal AI 审批发布到合思费控】的集成配置列表",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -52,7 +52,7 @@ export const deployCapabilities = [
}
},
{
name: "seal_deploy_hosecloud_get",
name: "sealDeployHosecloudGet",
description: "查询【Seal AI 审批发布到合思费控】的单项配置详情",
parameters: z.object({
signKey: z.string().describe("合思集成 sign-key")
@@ -69,7 +69,7 @@ export const deployCapabilities = [
}
},
{
name: "seal_deploy_hosecloud_status",
name: "sealDeployHosecloudStatus",
description: "检查【Seal AI 审批发布到合思费控】与多平台集成状态",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -83,7 +83,7 @@ export const deployCapabilities = [
}
},
{
name: "seal_deploy_hosecloud_configure",
name: "sealDeployHosecloudConfigure",
description: "自动探测平台并保存【Seal AI 审批发布到合思费控】集成配置",
parameters: z.object({
// Optional in the schema because the handler accepts two spellings of the
@@ -185,7 +185,7 @@ export const deployCapabilities = [
}
},
{
name: "seal_deploy_hosecloud_sync",
name: "sealDeployHosecloudSync",
description: "一键将 Seal AI 审核配置同步发布到合思费控审批流",
parameters: z.object({
signKey: z.string().describe("合思集成 sign-key")
+12 -12
View File
@@ -8,25 +8,25 @@ import type {
export const identityCapabilities = [
{
name: "seal_whoami",
name: "sealWhoami",
description: "查询当前 Seal 用户身份及租户信息",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getMe(client)
},
{
name: "seal_session_get",
name: "sealSessionGet",
description: "查询当前 Seal Bearer session、用户和过期时间",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getSession(client)
},
{
name: "seal_delegation_list",
name: "sealDelegationList",
description: "查询当前 Seal 租户下的授权链接 (Delegation) 列表",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listDelegations(client)
},
{
name: "seal_delegation_create",
name: "sealDelegationCreate",
description: "创建新的 Seal 授权链接 (Delegation)",
parameters: z.object({
note: z.string().optional().describe("授权链接的备注或说明信息")
@@ -35,7 +35,7 @@ export const identityCapabilities = [
api.createDelegation(client, params)
},
{
name: "seal_delegation_revoke",
name: "sealDelegationRevoke",
description: "撤销/废除指定的 Seal 授权链接 (Delegation)",
parameters: z.object({
tokenId: z.string().describe("授权链接 ID (delegation record ID)")
@@ -44,7 +44,7 @@ export const identityCapabilities = [
api.revokeDelegation(client, params.tokenId)
},
{
name: "seal_user_create",
name: "sealUserCreate",
description: "创建本地 Seal 用户,生成并返回初始随机密码",
parameters: z.object({
name: z.string().describe("用户姓名"),
@@ -58,7 +58,7 @@ export const identityCapabilities = [
) => api.createLocalUser(client, params)
},
{
name: "seal_user_reset_password",
name: "sealUserResetPassword",
description: "重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",
parameters: z.object({
userId: z.string().describe("用户 ID (_id)")
@@ -67,7 +67,7 @@ export const identityCapabilities = [
api.resetUserPassword(client, params.userId)
},
{
name: "seal_user_get",
name: "sealUserGet",
description: "获取指定 Seal 用户的详细信息",
parameters: z.object({
userId: z.string().describe("用户 ID (_id)")
@@ -76,7 +76,7 @@ export const identityCapabilities = [
api.getUserDetail(client, params.userId)
},
{
name: "seal_user_search",
name: "sealUserSearch",
description: "按姓名、手机号或邮箱搜索 Seal 成员用户列表",
parameters: z.object({
keyword: z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")
@@ -85,7 +85,7 @@ export const identityCapabilities = [
api.searchUsers(client, params.keyword ?? "")
},
{
name: "seal_user_delete",
name: "sealUserDelete",
description: "删除指定 Seal 本地用户",
parameters: z.object({
userId: z.string().describe("用户 ID (_id)")
@@ -94,7 +94,7 @@ export const identityCapabilities = [
api.deleteLocalUser(client, params.userId)
},
{
name: "seal_user_activate",
name: "sealUserActivate",
description: "启用/激活已离职的 Seal 用户账号",
parameters: z.object({
userId: z.string().describe("用户 ID (_id)")
@@ -103,7 +103,7 @@ export const identityCapabilities = [
api.activateLocalUser(client, params.userId)
},
{
name: "seal_user_delegation_create",
name: "sealUserDelegationCreate",
description: "为指定 Seal 用户(按用户ID、手机号或姓名)重置密码登录并生成其专属授权链接 (Delegation)",
parameters: z.object({
userIdOrPhone: z.string().describe("目标用户 ID、手机号或姓名"),
+107 -107
View File
@@ -29,127 +29,127 @@ export type SealCapability = (typeof sealCapabilities)[number];
/**
* Registry naming boundary: these entries are INTERNAL domain capability handlers, NOT MCP tools.
* The `seal_*` strings are identifiers for internal dispatch (`runCapability`), the HTTP adapter
* (`POST /api/tool/:name`), and the MCP gateway allow-lists below — the MCP server itself only ever
* exposes the `seal_cli` / `seal_cli_write` gateway pair and never these names. CLI verbs such as
* `seal-use context` are the only human-facing names (see README "One registry, three doors").
* 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_mcp` / `seal_use_mcp_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_cli`) may only invoke names in {@link SEAL_READ_ONLY_CAPABILITIES}; everything else is reachable
* solely through `seal_cli_write`.
* (`seal_use_mcp`) may only invoke names in {@link SEAL_READ_ONLY_CAPABILITIES}; everything else is reachable
* solely through `seal_use_mcp_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. `seal_insight_record_analyze` is the instructive case: it
* 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([
"seal_approval_context_get",
"seal_approval_document_get",
"seal_approval_documents_list",
"seal_approval_rule_get",
"seal_approval_rule_version_diff",
"seal_approval_rule_version_get",
"seal_approval_rule_versions_list",
"seal_approval_rules_lint",
"seal_approval_rules_list",
"seal_approval_rules_pull",
"seal_approval_run_attachments_get",
"seal_approval_run_cited_rules_get",
"seal_approval_run_diagnose",
"seal_approval_run_document_summary_get",
"seal_approval_run_flow_get",
"seal_approval_run_get",
"seal_approval_run_langfuse_bridge_get",
"seal_approval_run_pick",
"seal_approval_run_result_get",
"seal_approval_run_url_get",
"seal_approval_runs_count",
"seal_approval_runs_export",
"seal_approval_runs_search",
"seal_approval_runs_stats",
"seal_approval_runs_summary",
"seal_approval_search",
"seal_approval_style_preferences_get",
"seal_billing_features_list",
"seal_billing_plans_list",
"seal_billing_status_get",
"seal_contacts_department_children_list",
"seal_contacts_department_get",
"seal_contacts_department_users_list",
"seal_contacts_departments_root_list",
"seal_contacts_last_sync_time_get",
"seal_delegation_list",
"seal_deploy_hosecloud_get",
"seal_deploy_hosecloud_list",
"seal_deploy_hosecloud_requirements",
"seal_deploy_hosecloud_status",
"seal_expenses_list",
"seal_insight_export",
"seal_insight_performance_get",
"seal_insight_risks_by_tag_get",
"seal_insight_stats_get",
"seal_invoices_list",
"seal_llm_config_get",
"seal_llm_providers_list",
"seal_permissions_available_list",
"seal_permissions_configs_list",
"seal_preference_get",
"seal_preference_thinking_depth_policies_list",
"seal_session_get",
"seal_simulation_batch_get",
"seal_simulation_batch_records_get",
"seal_simulation_batch_status",
"seal_simulation_batch_wait",
"seal_simulation_batches_list",
"seal_simulation_feishu_approval_definitions_list",
"seal_simulation_integrations_get",
"seal_simulation_specifications_list",
"seal_simulation_templates_get",
"seal_user_get",
"seal_user_search",
"seal_webhook_get",
"seal_webhook_list",
"seal_webhook_ready",
"seal_whoami"
"sealApprovalContextGet",
"sealApprovalDocumentGet",
"sealApprovalDocumentsList",
"sealApprovalRuleGet",
"sealApprovalRuleVersionDiff",
"sealApprovalRuleVersionGet",
"sealApprovalRuleVersionsList",
"sealApprovalRulesLint",
"sealApprovalRulesList",
"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",
"sealInsightExport",
"sealInsightPerformanceGet",
"sealInsightRisksByTagGet",
"sealInsightStatsGet",
"sealInvoicesList",
"sealLlmConfigGet",
"sealLlmProvidersList",
"sealPermissionsAvailableList",
"sealPermissionsConfigsList",
"sealPreferenceGet",
"sealPreferenceThinkingDepthPoliciesList",
"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([
"seal_approval_delete_document",
"seal_approval_document_create",
"seal_approval_document_update",
"seal_approval_rule_create",
"seal_approval_rule_delete",
"seal_approval_rule_update",
"seal_approval_rule_version_publish",
"seal_approval_rules_clear",
"seal_approval_rules_push",
"seal_approval_style_preferences_update",
"seal_delegation_create",
"seal_delegation_revoke",
"seal_deploy_hosecloud_configure",
"seal_deploy_hosecloud_sync",
"seal_insight_record_analyze",
"seal_preference_decision_update",
"seal_preference_thinking_depth_policies_remove",
"seal_preference_thinking_depth_policies_upsert",
"seal_preference_thinking_depth_set",
"seal_simulation_batch_clean",
"seal_simulation_batch_create",
"seal_simulation_material_package_upload",
"seal_user_activate",
"seal_user_create",
"seal_user_delegation_create",
"seal_user_delete",
"seal_user_reset_password",
"seal_webhook_add",
"seal_webhook_delete",
"seal_webhook_material_pack",
"seal_webhook_replay",
"seal_webhook_update"
"sealApprovalDeleteDocument",
"sealApprovalDocumentCreate",
"sealApprovalDocumentUpdate",
"sealApprovalRuleCreate",
"sealApprovalRuleDelete",
"sealApprovalRuleUpdate",
"sealApprovalRuleVersionPublish",
"sealApprovalRulesClear",
"sealApprovalRulesPush",
"sealApprovalStylePreferencesUpdate",
"sealDelegationCreate",
"sealDelegationRevoke",
"sealDeployHosecloudConfigure",
"sealDeployHosecloudSync",
"sealInsightRecordAnalyze",
"sealPreferenceDecisionUpdate",
"sealPreferenceThinkingDepthPoliciesRemove",
"sealPreferenceThinkingDepthPoliciesUpsert",
"sealPreferenceThinkingDepthSet",
"sealSimulationBatchClean",
"sealSimulationBatchCreate",
"sealSimulationMaterialPackageUpload",
"sealUserActivate",
"sealUserCreate",
"sealUserDelegationCreate",
"sealUserDelete",
"sealUserResetPassword",
"sealWebhookAdd",
"sealWebhookDelete",
"sealWebhookMaterialPack",
"sealWebhookReplay",
"sealWebhookUpdate"
]);
export function isReadOnlySealCapability(name: string): boolean {
+7 -7
View File
@@ -8,7 +8,7 @@ import type {
export const insightCapabilities = [
{
name: "seal_insight_stats_get",
name: "sealInsightStatsGet",
description: "查询智能洞察风险标签统计及分析状态",
parameters: z.object({
startDate: z.string().optional().describe("统计开始时间(ISO 8601)"),
@@ -21,7 +21,7 @@ export const insightCapabilities = [
) => api.getInsightStats(client, params)
},
{
name: "seal_insight_risks_by_tag_get",
name: "sealInsightRisksByTagGet",
description: "按风险标签查询智能洞察风险单据明细及 AI 分析依据",
parameters: z.object({
tagId: z.string().describe("风险标签 ID(如 B.1.1、B.1.6)"),
@@ -34,7 +34,7 @@ export const insightCapabilities = [
) => api.getInsightRisksByTag(client, params)
},
{
name: "seal_insight_performance_get",
name: "sealInsightPerformanceGet",
description: "查询智能洞察审核效能指标(自动化率、准确率等)及决策流向桑基图",
parameters: z.object({
startDate: z.union([z.string(), z.number()]).optional().describe("统计开始时间(ISO 8601 或毫秒时间戳)"),
@@ -46,7 +46,7 @@ export const insightCapabilities = [
) => api.getInsightPerformance(client, params)
},
{
name: "seal_insight_record_analyze",
name: "sealInsightRecordAnalyze",
description: "对指定的审批单运行记录按需触发智能洞察风险分析",
parameters: z.object({
recordId: z.string().describe("审批单运行记录 ID (recordId)")
@@ -57,7 +57,7 @@ export const insightCapabilities = [
) => api.analyzeInsightRecord(client, params.recordId)
},
{
name: "seal_insight_export",
name: "sealInsightExport",
description: "导出智能洞察风险研报为高保真 Excel 文件(含效能概览、Top风险标签、风险单据穿透明细)",
parameters: z.object({
startDate: z.string().optional().describe("统计开始时间(ISO 8601 或时间戳)"),
@@ -74,7 +74,7 @@ export const insightCapabilities = [
) => exportInsightReportToExcel(client, context.corp, params)
},
{
name: "seal_expenses_list",
name: "sealExpensesList",
description: "分页查询费用明细",
parameters: z.object({
offset: z.number().int().nonnegative().optional(),
@@ -86,7 +86,7 @@ export const insightCapabilities = [
handler: async (client: KyInstance, params: api.DataListParams) => api.listExpenses(client, params)
},
{
name: "seal_invoices_list",
name: "sealInvoicesList",
description: "分页查询进项发票",
parameters: z.object({
offset: z.number().int().nonnegative().optional(),
+6 -6
View File
@@ -17,7 +17,7 @@ const {
export const preferenceCapabilities = [
{
name: "seal_preference_get",
name: "sealPreferenceGet",
description: "获取当前决策偏好、思考深度偏好与绑定的规则版本",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -30,7 +30,7 @@ export const preferenceCapabilities = [
}
},
{
name: "seal_preference_decision_update",
name: "sealPreferenceDecisionUpdate",
description: "修改审核决策偏好(立即影响当前运行中的审核智能体及后续决策)",
parameters: z.object({
explicitApprove: z.string().optional(),
@@ -57,7 +57,7 @@ export const preferenceCapabilities = [
}
},
{
name: "seal_preference_thinking_depth_set",
name: "sealPreferenceThinkingDepthSet",
description: "修改默认思考深度(medium 或 high)",
parameters: z.object({
defaultLevel: z.enum(["medium", "high"]).describe("默认思考深度"),
@@ -80,7 +80,7 @@ export const preferenceCapabilities = [
}
},
{
name: "seal_preference_thinking_depth_policies_list",
name: "sealPreferenceThinkingDepthPoliciesList",
description: "列出思考深度路由策略列表",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -91,7 +91,7 @@ export const preferenceCapabilities = [
}
},
{
name: "seal_preference_thinking_depth_policies_upsert",
name: "sealPreferenceThinkingDepthPoliciesUpsert",
description: "新增或修改思考深度路由策略",
parameters: ThinkingPolicySchema.extend({
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
@@ -118,7 +118,7 @@ export const preferenceCapabilities = [
}
},
{
name: "seal_preference_thinking_depth_policies_remove",
name: "sealPreferenceThinkingDepthPoliciesRemove",
description: "删除一条思考深度路由策略",
parameters: z.object({
policyId: z.string().describe("路由策略 ID"),
+22 -22
View File
@@ -49,7 +49,7 @@ function attachCrossEnvRule(context: CapabilityContext, rule: Record<string, unk
export const rulesCapabilities = [
{
name: "seal_approval_rules_list",
name: "sealApprovalRulesList",
description: "列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",
parameters: z.object({
version: z.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),
@@ -103,7 +103,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rules_clear",
name: "sealApprovalRulesClear",
description: "清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",
parameters: z.object({
dryRun: z.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),
@@ -172,7 +172,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_create",
name: "sealApprovalRuleCreate",
description: "新建 Seal 草稿审批规则",
parameters: z.object({
description: z.string().describe("规则描述"),
@@ -189,7 +189,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_update",
name: "sealApprovalRuleUpdate",
description: "更新 Seal 草稿审批规则;支持 --if-unchanged 乐观并发预检(草稿在基准后被他人修改则拒绝)",
parameters: z.object({
ruleId: z.string().describe("规则 ID 或规则编号 code"),
@@ -274,7 +274,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_delete",
name: "sealApprovalRuleDelete",
description: "删除 Seal 草稿审批规则",
parameters: z.object({
ruleId: z.string().describe("规则 ID 或规则编号 code")
@@ -299,7 +299,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_versions_list",
name: "sealApprovalRuleVersionsList",
description: "列出 Seal 已发布审批规则版本摘要,不展开每个版本的规则快照",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -312,7 +312,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_version_get",
name: "sealApprovalRuleVersionGet",
description: "获取指定 Seal 已发布审批规则版本详情,包含该版本的规则快照",
parameters: z.object({
versionId: z.string().optional().describe("规则版本 ID"),
@@ -340,7 +340,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_version_diff",
name: "sealApprovalRuleVersionDiff",
description: "对比两个已发布审批规则版本;优先使用本地持久化稳定 ID,没有时回退到 code",
parameters: z.object({
from: z.string().min(1).describe("起始规则版本号、版本 ID 或 latest"),
@@ -388,7 +388,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_version_publish",
name: "sealApprovalRuleVersionPublish",
description: "发布 Seal 草稿审批规则为新版本",
parameters: z.object({
versionName: z.string().describe("版本名称")
@@ -403,7 +403,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rule_get",
name: "sealApprovalRuleGet",
description: "按规则编号 code(或规则 ID)获取单条规则详情;默认读取当前草稿(含规则 ID),指定 version 或 recordId 时读取对应发布版本快照",
parameters: z.object({
versionId: z.string().optional().describe("规则版本 ID"),
@@ -466,7 +466,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rules_lint",
name: "sealApprovalRulesLint",
description: "对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",
parameters: z.object({
file: z.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),
@@ -566,7 +566,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rules_pull",
name: "sealApprovalRulesPull",
description: "从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",
parameters: z.object({
version: z.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),
@@ -639,7 +639,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_rules_push",
name: "sealApprovalRulesPush",
description: "将本地规则文件增量同步到远端草稿;按规则 ID 更新/删除并保留未变更规则,支持直接发布为正式版本",
parameters: z.object({
file: z.string().optional().describe("要推送的本地规则文件路径,默认为 ./rules.local.json"),
@@ -762,7 +762,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_documents_list",
name: "sealApprovalDocumentsList",
description: "列出 Seal 审批知识文档",
parameters: z.object({
scenarios: z.array(z.string()).optional().describe("场景过滤"),
@@ -775,7 +775,7 @@ export const rulesCapabilities = [
) => api.listApprovalDocuments(client, params)
},
{
name: "seal_approval_document_get",
name: "sealApprovalDocumentGet",
description: "获取 Seal 审批知识文档详情",
parameters: z.object({
documentId: z.string().describe("文档 ID")
@@ -784,7 +784,7 @@ export const rulesCapabilities = [
api.getApprovalDocument(client, params.documentId)
},
{
name: "seal_approval_document_create",
name: "sealApprovalDocumentCreate",
description: "新建 Seal 审批知识文档",
parameters: z.object({
title: z.string(),
@@ -811,7 +811,7 @@ export const rulesCapabilities = [
) => api.createApprovalDocument(client, params)
},
{
name: "seal_approval_document_update",
name: "sealApprovalDocumentUpdate",
description: "更新 Seal 审批知识文档",
parameters: z.object({
documentId: z.string(),
@@ -843,7 +843,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_delete_document",
name: "sealApprovalDeleteDocument",
description: "删除 Seal 审批知识文档",
parameters: z.object({
documentId: z.string().describe("知识文档 ID")
@@ -852,7 +852,7 @@ export const rulesCapabilities = [
api.deleteApprovalDocument(client, params.documentId)
},
{
name: "seal_approval_search",
name: "sealApprovalSearch",
description: "按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",
parameters: z.object({
keywords: z.array(z.string()).min(1).describe("关键词组"),
@@ -894,7 +894,7 @@ export const rulesCapabilities = [
) => searchApprovalContent(client, context.corp, params)
},
{
name: "seal_approval_context_get",
name: "sealApprovalContextGet",
description: "聚合获取 Seal 现有审批规则、审批文档和审批风格偏好",
parameters: z.object({
documentLimit: z.number().int().positive().optional().describe("最多返回的审批文档数量"),
@@ -932,7 +932,7 @@ export const rulesCapabilities = [
}
},
{
name: "seal_approval_style_preferences_get",
name: "sealApprovalStylePreferencesGet",
description: "获取 Seal 审批风格偏好配置",
parameters: z.object({}),
handler: async (client: KyInstance, _params: unknown, context: CapabilityContext) =>
@@ -942,7 +942,7 @@ export const rulesCapabilities = [
)
},
{
name: "seal_approval_style_preferences_update",
name: "sealApprovalStylePreferencesUpdate",
description: "更新 Seal 审批风格偏好配置",
parameters: z.object({
tone: z.string().optional(),
+12 -12
View File
@@ -20,7 +20,7 @@ const {
export const simulationCapabilities = [
{
name: "seal_simulation_feishu_approval_definitions_list",
name: "sealSimulationFeishuApprovalDefinitionsList",
description: "列出飞书模拟测试可用的审批定义,便于选择 approvalCode",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -29,7 +29,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_records_get",
name: "sealSimulationBatchRecordsGet",
description: "获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",
parameters: z.object({
batchId: z.string().describe("simulation batch ID"),
@@ -53,7 +53,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_create",
name: "sealSimulationBatchCreate",
description: "创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;默认幂等:复用窗口内同 flow-ids/packageIds 的既有批次直接返回不重复扣费(--force 跳过);其他取数模式通过 rawParams 预留透传。",
parameters: z.object({
mode: z.enum(["hosecloud", "material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),
@@ -185,7 +185,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batches_list",
name: "sealSimulationBatchesList",
description: "列出 Seal 模拟测试批次摘要(含状态、统计计数与展示摘要)",
parameters: z.object({
limit: z.number().int().positive().max(100).optional().describe("最多返回批次数量, 默认 50")
@@ -203,7 +203,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_get",
name: "sealSimulationBatchGet",
description: "获取某一次 Seal 模拟测试批次的详情,包含服务端回显的创建参数、展示摘要和任务统计",
parameters: z.object({
batchId: z.string().describe("simulation batch ID")
@@ -219,7 +219,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_status",
name: "sealSimulationBatchStatus",
description: "单次读取 Seal 模拟批次状态,不阻塞等待;适合根据异步票据轮询",
parameters: z.object({
batchId: z.string().describe("simulation batch ID")
@@ -245,7 +245,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_templates_get",
name: "sealSimulationTemplatesGet",
description: "列出 Seal 模拟测试模板(我的模板,保存常用配置快速复用)",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -267,7 +267,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_integrations_get",
name: "sealSimulationIntegrationsGet",
description: "查询模拟测试可用的来源集成状态与合思集成选项(signKey 等)",
parameters: z.object({}),
handler: async (client: KyInstance) => {
@@ -279,7 +279,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_material_package_upload",
name: "sealSimulationMaterialPackageUpload",
description: "上传材料包 ZIP 到 Seal 模拟测试;服务端解析 Excel/AI 推断配置并返回材料包 id 与 schemaConfig(字段映射确认后用于创建模拟批次)",
parameters: z.object({
filePath: z.string().describe("材料包 ZIP 文件路径(含 信息表.xlsx 与附件)")
@@ -303,7 +303,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_wait",
name: "sealSimulationBatchWait",
description: "等待 Seal 模拟测试批次完成(轮询状态直到 completed/failed/canceled 或超时)",
parameters: z.object({
batchId: z.string().describe("模拟批次 ID"),
@@ -339,7 +339,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_batch_clean",
name: "sealSimulationBatchClean",
description: "删除模拟测试批次产生的测试数据",
parameters: z.object({
batchId: z.string().describe("模拟批次 ID")
@@ -354,7 +354,7 @@ export const simulationCapabilities = [
}
},
{
name: "seal_simulation_specifications_list",
name: "sealSimulationSpecificationsList",
description: "列出指定合思集成可用的单据模板列表",
parameters: z.object({
signKey: z.string().optional().describe("合思集成 sign-key")
+11 -11
View File
@@ -22,7 +22,7 @@ function rejectsWith(toolName: string, params: Record<string, unknown>): string
describe("parseCapabilityParams", () => {
test("accepts valid params and returns the exact object it was given", () => {
const target = tool("seal_user_create");
const target = tool("sealUserCreate");
const params = { name: "张三", phone: "13800001111", departmentIds: ["d1"] };
// Identity matters: handlers read keys the schema does not declare, so the
@@ -31,19 +31,19 @@ describe("parseCapabilityParams", () => {
});
test("names the missing required field instead of letting the handler crash on undefined", () => {
const message = rejectsWith("seal_user_create", { phone: "13800001111" });
expect(message).toContain("seal_user_create");
const message = rejectsWith("sealUserCreate", { phone: "13800001111" });
expect(message).toContain("sealUserCreate");
expect(message).toContain("name");
});
test("enforces the value bound a handler would otherwise silently accept", () => {
// limit is capped at 100 in the schema; nothing in the handler checks it.
const message = rejectsWith("seal_approval_runs_search", { limit: 9999 });
const message = rejectsWith("sealApprovalRunsSearch", { limit: 9999 });
expect(message).toContain("limit");
});
test("coerces query-string values before checking, without touching the original", () => {
const target = tool("seal_approval_runs_search");
const target = tool("sealApprovalRunsSearch");
const params = { limit: "50", includeBridge: "true" } as Record<string, unknown>;
// /v1/* passes url.searchParams through: everything arrives as a string,
@@ -55,7 +55,7 @@ describe("parseCapabilityParams", () => {
});
test("still rejects a string that merely looks like a wire value", () => {
const message = rejectsWith("seal_approval_runs_search", { limit: "abc" });
const message = rejectsWith("sealApprovalRunsSearch", { limit: "abc" });
expect(message).toContain("limit");
});
@@ -63,25 +63,25 @@ describe("parseCapabilityParams", () => {
// `?fields=id,code` on /v1/approval/rules: today the handler receives a
// string and pickRuleFields iterates its characters, returning empty
// objects. Validation splits it so the documented form actually works.
expect(parseCapabilityParams(tool("seal_approval_rules_list"), { fields: "id,code" })).toEqual({
expect(parseCapabilityParams(tool("sealApprovalRulesList"), { fields: "id,code" })).toEqual({
fields: "id,code"
});
expect(rejectsWith("seal_approval_rules_list", { fields: "id,not-a-field" })).toContain("fields");
expect(rejectsWith("sealApprovalRulesList", { fields: "id,not-a-field" })).toContain("fields");
});
test("ignores undeclared keys rather than rejecting the request", () => {
// z.object is non-strict: an extra HTTP body key is a compatibility
// non-event, not an error. This gate checks declared params only.
const target = tool("seal_approval_runs_search");
const target = tool("sealApprovalRunsSearch");
expect(parseCapabilityParams(target, { status: "TERMINATED", corp: "corp-a", stray: 1 })).toBeTypeOf("object");
});
test("lets the legacy credential aliases through to the handler that supports them", () => {
// seal_deploy_hosecloud_configure has always accepted appKey/appSecurity
// sealDeployHosecloudConfigure has always accepted appKey/appSecurity
// alongside apiKey/apiSecret; a schema that declared only apiKey as
// required would have blocked that documented path.
expect(() =>
parseCapabilityParams(tool("seal_deploy_hosecloud_configure"), {
parseCapabilityParams(tool("sealDeployHosecloudConfigure"), {
appKey: "key-1",
appSecurity: "secret-1",
mode: "assisted"
+1 -1
View File
@@ -17,7 +17,7 @@ import type { SealCapability } from "./index.js";
* Two deliberate properties:
*
* - **Original params are returned, not `result.data`.** Handlers read keys the
* schema does not declare — `seal_deploy_hosecloud_configure` accepts the
* schema does not declare — `sealDeployHosecloudConfigure` accepts the
* legacy `appKey`/`appSecurity` aliases alongside `apiKey`/`apiSecret` — and
* zod's default strip would silently drop them. Validation must never change
* what a working handler receives, only block what would have failed anyway.
+8 -8
View File
@@ -31,7 +31,7 @@ const {
export const webhookCapabilities = [
{
name: "seal_webhook_list",
name: "sealWebhookList",
description: "列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",
parameters: z.object({
query: z.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),
@@ -56,7 +56,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_get",
name: "sealWebhookGet",
description: "按 Webhook 集成 ID 或名称精确查找一条集成",
parameters: z.object({
selector: z.string().min(1).describe("Webhook 集成 ID 或名称"),
@@ -78,7 +78,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_add",
name: "sealWebhookAdd",
description: "新增 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
name: z.string().min(1).describe("集成名称"),
@@ -128,7 +128,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_update",
name: "sealWebhookUpdate",
description: "更新现有 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
selector: z.string().min(1).describe("Webhook 集成 ID 或名称"),
@@ -187,7 +187,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_delete",
name: "sealWebhookDelete",
description: "删除指定 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
selector: z.string().min(1).describe("Webhook 集成 ID 或名称"),
@@ -226,7 +226,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_replay",
name: "sealWebhookReplay",
description: "将正式(生产)企业或指定企业的审批记录通过 Webhook 渠道重放到测试企业进行规则回归与模拟验证",
parameters: z.object({
recordId: z.string().optional().describe("待重放的单条审批记录 ID"),
@@ -304,7 +304,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_ready",
name: "sealWebhookReady",
description: "检查当前企业的 Webhook 就绪状态看板(包括企业环境、租户身份、凭证连通性、已激活 Webhook 通道及材料包预检)",
parameters: z.object({
filePath: z.string().optional().describe("可选的材料包路径(ZIP 或 信息表.xlsx),用于同步做本地预检")
@@ -318,7 +318,7 @@ export const webhookCapabilities = [
}
},
{
name: "seal_webhook_material_pack",
name: "sealWebhookMaterialPack",
description: "将官方材料包格式本地校验、解析并通过 Seal 入站 Webhook 触发 AI 审批;preview 模式不联网,push 模式单通道自动选择",
parameters: z.object({
filePath: z.string().describe("材料包 ZIP 或 信息表.xlsx 文件路径"),
+2 -2
View File
@@ -109,7 +109,7 @@ describe("rules-local offline lint tool integration", () => {
]
});
const lintCapability = findSealCapability("seal_approval_rules_lint")!;
const lintCapability = findSealCapability("sealApprovalRulesLint")!;
expect(lintCapability).toBeDefined();
const result = await lintCapability.handler(
@@ -139,7 +139,7 @@ describe("rules-local offline lint tool integration", () => {
]
});
const lintCapability = findSealCapability("seal_approval_rules_lint")!;
const lintCapability = findSealCapability("sealApprovalRulesLint")!;
const result = await lintCapability.handler(
null as any,
+13 -13
View File
@@ -529,7 +529,7 @@ describe("findReusableSimulationBatch", () => {
describe("simulation tool handlers", () => {
test("create tool resolves signKey automatically and posts the payload", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_create");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchCreate");
expect(tool).toBeDefined();
let postedBody: Record<string, unknown> | undefined;
@@ -579,7 +579,7 @@ describe("simulation tool handlers", () => {
});
test("create tool reuses a recent identical batch instead of creating a new one", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_create");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchCreate");
expect(tool).toBeDefined();
let postCalls = 0;
@@ -625,7 +625,7 @@ describe("simulation tool handlers", () => {
});
test("create tool force bypasses the reuse check", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_create");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchCreate");
let posted = false;
const client = {
get: (url: string) => {
@@ -665,7 +665,7 @@ describe("simulation tool handlers", () => {
});
test("create tool creates a new batch when the identical batch is outside the reuse window", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_create");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchCreate");
let posted = false;
const client = {
get: (url: string) => {
@@ -703,7 +703,7 @@ describe("simulation tool handlers", () => {
});
test("create tool surface exposes mode, flowIds, and rawParams", () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_create");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchCreate");
const { z } = require("zod") as typeof import("zod");
const schema = z.toJSONSchema(tool!.parameters) as { properties?: Record<string, unknown> };
expect(Object.keys(schema.properties ?? {})).toEqual(
@@ -712,17 +712,17 @@ describe("simulation tool handlers", () => {
});
test("includes the simulation management tool set", () => {
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batches_list")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_status")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_templates_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_integrations_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_batch_records_get")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "seal_simulation_material_package_upload")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchesList")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchStatus")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationTemplatesGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationIntegrationsGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationBatchRecordsGet")).toBeDefined();
expect(sealCapabilities.find((item) => item.name === "sealSimulationMaterialPackageUpload")).toBeDefined();
});
test("status tool performs one non-blocking check and exposes the next action", async () => {
const tool = sealCapabilities.find((item) => item.name === "seal_simulation_batch_status");
const tool = sealCapabilities.find((item) => item.name === "sealSimulationBatchStatus");
expect(tool).toBeDefined();
const client = {
+8 -8
View File
@@ -3,8 +3,8 @@ import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import {
createServer,
resolveMcpEnabled,
SEAL_CLI_TOOL_NAME,
SEAL_CLI_WRITE_TOOL_NAME,
SEAL_USE_MCP_TOOL_NAME,
SEAL_USE_MCP_WRITE_TOOL_NAME,
SEAL_MCP_ENABLED_ENV,
tokenizeCommand
} from "./server.js";
@@ -52,7 +52,7 @@ describe("seal-use MCP server", () => {
]);
const listed = await client.listTools();
expect(listed.tools.map((tool) => tool.name)).toEqual([SEAL_CLI_TOOL_NAME, SEAL_CLI_WRITE_TOOL_NAME]);
expect(listed.tools.map((tool) => tool.name)).toEqual([SEAL_USE_MCP_TOOL_NAME, SEAL_USE_MCP_WRITE_TOOL_NAME]);
expect(listed.tools[0]?.inputSchema).toMatchObject({
type: "object",
required: ["command"],
@@ -74,7 +74,7 @@ describe("seal-use MCP server", () => {
});
const result = await client.callTool({
name: SEAL_CLI_TOOL_NAME,
name: SEAL_USE_MCP_TOOL_NAME,
arguments: { command: "seal-use version" }
});
const content = result.content as Array<{ type: "text"; text: string }>;
@@ -86,7 +86,7 @@ describe("seal-use MCP server", () => {
}
const invalid = await client.callTool({
name: SEAL_CLI_TOOL_NAME,
name: SEAL_USE_MCP_TOOL_NAME,
arguments: { command: "not-a-command" }
});
expect(invalid.isError).toBe(true);
@@ -94,7 +94,7 @@ describe("seal-use MCP server", () => {
const errorText = invalidContent[0];
expect(errorText?.type).toBe("text");
if (errorText?.type === "text") {
expect(errorText.text).toContain(SEAL_CLI_WRITE_TOOL_NAME);
expect(errorText.text).toContain(SEAL_USE_MCP_WRITE_TOOL_NAME);
}
} finally {
await Promise.allSettled([client.close(), server.close()]);
@@ -107,7 +107,7 @@ describe("seal-use MCP server", () => {
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
const callRead = async (command: string) => {
const result = await client.callTool({ name: SEAL_CLI_TOOL_NAME, arguments: { command } });
const result = await client.callTool({ name: SEAL_USE_MCP_TOOL_NAME, arguments: { command } });
const content = result.content as Array<{ type: "text"; text: string }>;
return { isError: result.isError, text: content[0]?.text ?? "" };
};
@@ -167,7 +167,7 @@ describe("seal-use MCP server", () => {
]);
const result = await client.callTool({
name: SEAL_CLI_WRITE_TOOL_NAME,
name: SEAL_USE_MCP_WRITE_TOOL_NAME,
arguments: { command: "seal-use corps mark missing-corp --env production --confirm" }
});
const content = result.content as Array<{ type: "text"; text: string }>;
+10 -10
View File
@@ -14,8 +14,8 @@ const serverEntryFile = fileURLToPath(import.meta.url);
// no packaged bundle anymore, so two levels up is always the app root.
const pluginRoot = dirname(dirname(serverEntryFile));
export const SEAL_CLI_TOOL_NAME = "seal_cli";
export const SEAL_CLI_WRITE_TOOL_NAME = "seal_cli_write";
export const SEAL_USE_MCP_TOOL_NAME = "seal_use_mcp";
export const SEAL_USE_MCP_WRITE_TOOL_NAME = "seal_use_mcp_write";
export const SEAL_MCP_ENABLED_ENV = "SEAL_USE_MCP_ENABLED";
export const LEGACY_SEAL_MCP_ENABLED_ENV = "SEAL_HOME_MCP_ENABLED";
@@ -35,7 +35,7 @@ export function createServer(options: { enableCli?: boolean } = {}): McpServer {
},
{
// Declared explicitly so that `tools/list` answers with an empty list (rather than a
// method-not-found error) when seal_cli is switched off by configuration.
// method-not-found error) when seal_use_mcp is switched off by configuration.
capabilities: { tools: {} }
}
);
@@ -48,14 +48,14 @@ export function createServer(options: { enableCli?: boolean } = {}): McpServer {
});
server.registerTool(
SEAL_CLI_TOOL_NAME,
SEAL_USE_MCP_TOOL_NAME,
{
title: "Run read-only seal-use CLI command",
description:
"Run a read-only seal-use CLI command and return its JSON stdout. Only commands that " +
"read tenant state without changing it are accepted here; anything that mutates tenant " +
"state, publishes configuration, mints credentials, self-updates or starts a server is " +
`refused — use ${SEAL_CLI_WRITE_TOOL_NAME} for those after confirming with the user.`,
`refused — use ${SEAL_USE_MCP_WRITE_TOOL_NAME} for those after confirming with the user.`,
inputSchema,
annotations: {
readOnlyHint: true,
@@ -69,7 +69,7 @@ export function createServer(options: { enableCli?: boolean } = {}): McpServer {
);
server.registerTool(
SEAL_CLI_WRITE_TOOL_NAME,
SEAL_USE_MCP_WRITE_TOOL_NAME,
{
title: "Run mutating seal-use CLI command",
description:
@@ -96,7 +96,7 @@ async function executeCliCommand(
command: string | undefined,
options: { requireReadOnly: boolean }
): Promise<CallToolResult> {
const toolName = options.requireReadOnly ? SEAL_CLI_TOOL_NAME : SEAL_CLI_WRITE_TOOL_NAME;
const toolName = options.requireReadOnly ? SEAL_USE_MCP_TOOL_NAME : SEAL_USE_MCP_WRITE_TOOL_NAME;
if (!command?.trim()) {
return cliResult({
stdout: "",
@@ -128,8 +128,8 @@ async function executeCliCommand(
return cliResult({
stdout: "",
stderr:
`${SEAL_CLI_TOOL_NAME} only runs read-only commands, and "${cliArgs.join(" ")}" is not one of ` +
`them. Confirm the command with the user, then call ${SEAL_CLI_WRITE_TOOL_NAME}.`,
`${SEAL_USE_MCP_TOOL_NAME} only runs read-only commands, and "${cliArgs.join(" ")}" is not one of ` +
`them. Confirm the command with the user, then call ${SEAL_USE_MCP_WRITE_TOOL_NAME}.`,
isError: true,
exitCode: 2
});
@@ -161,7 +161,7 @@ export function startServer(): StdioServerHandle {
console.error(
enableCli
? "seal-use MCP server running on stdio"
: "seal-use MCP server connected with seal_cli disabled by configuration"
: "seal-use MCP server connected with seal_use_mcp disabled by configuration"
);
return handle;
}