Rename the internal tool registry to capability registry

This commit is contained in:
gitea committed 2026-09-30 14:47:51 +08:00
1 parent f8b2b2ecde
commit bc9256a9d9
41 files changed
+470 -452

No files matched your search

+14 -14
View File
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { confirmationRequired } from "../errors.js";
import { runTool, runToolResult } from "../helpers.js";
import { runCapability, runCapabilityResult } from "../helpers.js";
import {
booleanOption,
jsonObject,
@@ -23,7 +23,7 @@ export async function handleSimulationCommand(
if (action === "batch-records" || action === "records") {
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 runTool(
await runCapability(
"seal_simulation_batch_records_get",
client,
corp,
@@ -66,7 +66,7 @@ export async function handleSimulationCommand(
const wait = booleanOption(args.options.wait) === true;
const noWait = booleanOption(args.options.noWait) ?? booleanOption(args.options["no-wait"]) ?? (wait ? false : true);
const result = await runToolResult(
const result = await runCapabilityResult(
"seal_simulation_batch_create",
client,
corp,
@@ -102,7 +102,7 @@ export async function handleSimulationCommand(
);
if (wait && result && typeof result === "object" && "batchId" in result && typeof result.batchId === "string") {
await runTool(
await runCapability(
"seal_simulation_batch_wait",
client,
corp,
@@ -123,7 +123,7 @@ export async function handleSimulationCommand(
if (action === "wait") {
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 runTool(
await runCapability(
"seal_simulation_batch_wait",
client,
corp,
@@ -140,7 +140,7 @@ export async function handleSimulationCommand(
if (action === "status") {
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation status <batchId>");
await runTool(
await runCapability(
"seal_simulation_batch_status",
client,
corp,
@@ -160,7 +160,7 @@ export async function handleSimulationCommand(
`seal-use simulation clean ${batchId} --corp ${corp.id} --yes`
);
}
await runTool("seal_simulation_batch_clean", client, corp, { batchId }, outputOptions(args.options));
await runCapability("seal_simulation_batch_clean", client, corp, { batchId }, outputOptions(args.options));
return;
}
@@ -170,12 +170,12 @@ export async function handleSimulationCommand(
stringOption(args.options.integration) ??
stringOption(args.options.signKey) ??
stringOption(args.options["sign-key"]);
await runTool("seal_simulation_specifications_list", client, corp, { signKey }, outputOptions(args.options));
await runCapability("seal_simulation_specifications_list", client, corp, { signKey }, outputOptions(args.options));
return;
}
if (action === "approval-definitions" || action === "definitions") {
await runTool(
await runCapability(
"seal_simulation_feishu_approval_definitions_list",
client,
corp,
@@ -186,7 +186,7 @@ export async function handleSimulationCommand(
}
if (action === "list") {
await runTool(
await runCapability(
"seal_simulation_batches_list",
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 runTool("seal_simulation_batch_get", client, corp, { batchId }, outputOptions(args.options));
await runCapability("seal_simulation_batch_get", client, corp, { batchId }, outputOptions(args.options));
return;
}
if (action === "templates") {
await runTool("seal_simulation_templates_get", client, corp, {}, outputOptions(args.options));
await runCapability("seal_simulation_templates_get", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "integrations") {
await runTool("seal_simulation_integrations_get", client, corp, {}, outputOptions(args.options));
await runCapability("seal_simulation_integrations_get", 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 runTool("seal_simulation_material_package_upload", client, corp, { filePath }, outputOptions(args.options));
await runCapability("seal_simulation_material_package_upload", client, corp, { filePath }, outputOptions(args.options));
return;
}