Add simulation test batch creation and material package upload

Support the release loop against Seal simulation batches:
- simulation create (hosecloud specified single-number and material_pack
  modes; other collection modes reserved via rawParams passthrough)
- simulation list/get/templates/integrations/package-upload
- schema modeling from captured staging traffic, mode-scoped request params
- new MCP tools and OpenAPI paths; bump version to 0.6.0

Tests: bun run check, bun test (114 pass).
This commit is contained in:
gitea committed 2026-08-24 18:10:05 +08:00
1 parent 39de757042
commit 0e52a295ba
13 files changed
+1883 -17

No files matched your search

+66 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bun
import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -723,6 +723,64 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "simulation" && action === "create") {
const modeArg = stringOption(args.options.mode) ?? "hosecloud";
const mode = modeArg === "material-pack" ? "material_pack" : modeArg;
const schemaConfigPath = stringOption(args.options.schemaConfig) ?? stringOption(args.options["schema-config"]);
const schemaConfig = schemaConfigPath
? JSON.parse(readFileSync(schemaConfigPath, "utf8"))
: undefined;
await runTool("seal_simulation_batch_create", client, corp, {
mode,
flowIds: splitOption(args.options.flowIds) ?? splitOption(args.options["flow-ids"]),
limit: numberOption(args.options.limit),
rejectNodeName: stringOption(args.options.rejectNode) ?? stringOption(args.options["reject-node"]) ?? null,
thinkingDepthOverride: stringOption(args.options.thinkingDepth) ?? stringOption(args.options["thinking-depth"]),
skipInvoiceGeneration: booleanOption(args.options.skipInvoiceGeneration) ?? booleanOption(args.options["skip-invoice-generation"]),
skipExpenseExtraction: booleanOption(args.options.skipExpenseExtraction) ?? booleanOption(args.options["skip-expense-extraction"]),
disableAttachmentCache: booleanOption(args.options.disableAttachmentCache) ?? booleanOption(args.options["disable-attachment-cache"]),
signKey: stringOption(args.options.signKey) ?? stringOption(args.options["sign-key"]),
packageIds: splitOption(args.options.packageIds) ?? splitOption(args.options["package-ids"]),
packageLabel: stringOption(args.options.packageLabel) ?? stringOption(args.options["package-label"]),
templateId: stringOption(args.options.templateId) ?? stringOption(args.options["template-id"]),
schemaConfig,
rawParams: jsonObject(args.json)
}, outputOptions(args.options));
return;
}
if (area === "simulation" && action === "list") {
await runTool("seal_simulation_batches_list", client, corp, {
limit: numberOption(args.options.limit)
}, outputOptions(args.options));
return;
}
if (area === "simulation" && action === "get") {
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-home simulation get <batchId>");
await runTool("seal_simulation_batch_get", client, corp, { batchId }, outputOptions(args.options));
return;
}
if (area === "simulation" && action === "templates") {
await runTool("seal_simulation_templates_get", client, corp, {}, outputOptions(args.options));
return;
}
if (area === "simulation" && action === "integrations") {
await runTool("seal_simulation_integrations_get", client, corp, {}, outputOptions(args.options));
return;
}
if (area === "simulation" && action === "package-upload") {
const filePath = maybeName ?? stringOption(args.options.file);
if (!filePath) throw new Error("Usage: seal-home 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));
return;
}
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-home help' for available commands.`);
}
@@ -1563,6 +1621,13 @@ Usage:
seal-home approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
seal-home approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
seal-home simulation batch-records <batchId> [--corp <corpId>]
seal-home simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--limit 2] [--reject-node 财务] [--thinking-depth medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--corp <corpId>]
seal-home simulation create --mode material_pack --package-ids <materialPackageId> [--package-label 名称] [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
seal-home simulation list [--limit 50] [--corp <corpId>]
seal-home simulation get <batchId> [--corp <corpId>]
seal-home simulation templates [--corp <corpId>]
seal-home simulation integrations [--corp <corpId>]
seal-home simulation package-upload <材料包.zip> [--corp <corpId>]
`);
}