Merge pull request #64 from yunyingk/codex/simulation-approval-definitions
Add simulation approval definition lookup
This commit is contained in:
8 files changed
+58
No files matched your search
@@ -116,6 +116,7 @@ seal-use simulation status <batchId> --corp <corpId>
|
||||
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] --corp <corpId>
|
||||
seal-use simulation clean <batchId> --corp <corpId>
|
||||
seal-use simulation specifications [--integration <sign-key>] --corp <corpId>
|
||||
seal-use simulation approval-definitions --corp <corpId>
|
||||
seal-use simulation list [--limit 50] --corp <corpId>
|
||||
seal-use simulation get <batchId> --corp <corpId>
|
||||
seal-use simulation templates --corp <corpId>
|
||||
|
||||
@@ -147,6 +147,17 @@ export async function handleSimulationCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "approval-definitions" || action === "definitions") {
|
||||
await runTool(
|
||||
"seal_simulation_feishu_approval_definitions_list",
|
||||
client,
|
||||
corp,
|
||||
{},
|
||||
outputOptions(args.options)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "list") {
|
||||
await runTool(
|
||||
"seal_simulation_batches_list",
|
||||
|
||||
@@ -183,6 +183,7 @@ Usage:
|
||||
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
|
||||
seal-use simulation clean <batchId> [--corp <corpId>]
|
||||
seal-use simulation specifications [--integration <sign-key>] [--corp <corpId>]
|
||||
seal-use simulation approval-definitions [--corp <corpId>]
|
||||
seal-use simulation list [--limit 50] [--corp <corpId>]
|
||||
seal-use simulation get <batchId> [--corp <corpId>]
|
||||
seal-use simulation templates [--corp <corpId>]
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
getInsightStats,
|
||||
listExpenses,
|
||||
listInvoices,
|
||||
listFeishuSimulationApprovalDefinitions,
|
||||
listDepartmentChildren,
|
||||
listDepartmentUsers,
|
||||
listRootDepartments,
|
||||
@@ -173,6 +174,23 @@ describe("Seal contact API", () => {
|
||||
"api/v1/invoice/list?filter%5BstartDate%5D=2026-08-31T16%3A00%3A00.000Z&filter%5BendDate%5D=2026-09-30T15%3A59%3A59.999Z&filter%5Bsearch%5D=zz-probe-no-match&offset=0&limit=50"
|
||||
]);
|
||||
});
|
||||
|
||||
test("lists Feishu simulation approval definitions", async () => {
|
||||
let requestedUrl = "";
|
||||
const client = {
|
||||
get: (url: string) => {
|
||||
requestedUrl = url;
|
||||
return {
|
||||
json: async () => ({ data: [{ code: "travel", name: "差旅报销" }] })
|
||||
};
|
||||
}
|
||||
} as unknown as KyInstance;
|
||||
|
||||
await expect(listFeishuSimulationApprovalDefinitions(client)).resolves.toEqual([
|
||||
{ code: "travel", name: "差旅报销" }
|
||||
]);
|
||||
expect(requestedUrl).toBe("api/v1/integrations/feishu/simulation/approval-definitions");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Seal Webhook API", () => {
|
||||
|
||||
@@ -55,6 +55,8 @@ import {
|
||||
ExpenseListDataSchema,
|
||||
InvoiceListData,
|
||||
InvoiceListDataSchema,
|
||||
SimulationApprovalDefinition,
|
||||
SimulationApprovalDefinitionSchema,
|
||||
LlmConfig,
|
||||
LlmConfigSchema,
|
||||
LlmProvider,
|
||||
@@ -1045,6 +1047,15 @@ export async function listInvoices(
|
||||
);
|
||||
}
|
||||
|
||||
export async function listFeishuSimulationApprovalDefinitions(
|
||||
client: KyInstance
|
||||
): Promise<SimulationApprovalDefinition[]> {
|
||||
return unwrap(
|
||||
await client.get("api/v1/integrations/feishu/simulation/approval-definitions"),
|
||||
z.array(SimulationApprovalDefinitionSchema)
|
||||
);
|
||||
}
|
||||
|
||||
export async function deleteLocalUser(
|
||||
client: KyInstance,
|
||||
userId: string
|
||||
|
||||
@@ -101,6 +101,10 @@ describe("sealTools", () => {
|
||||
expect(sealTools.find((item) => item.name === "seal_invoices_list")).toBeDefined();
|
||||
});
|
||||
|
||||
test("includes the Feishu simulation approval definition tool", () => {
|
||||
expect(sealTools.find((item) => item.name === "seal_simulation_feishu_approval_definitions_list")).toBeDefined();
|
||||
});
|
||||
|
||||
test("includes system configuration tools", () => {
|
||||
expect(sealTools.find((item) => item.name === "seal_llm_config_get")).toBeDefined();
|
||||
expect(sealTools.find((item) => item.name === "seal_llm_providers_list")).toBeDefined();
|
||||
|
||||
@@ -241,6 +241,15 @@ export const sealTools = [
|
||||
}),
|
||||
handler: async (client: KyInstance, params: api.DataListParams) => api.listInvoices(client, params)
|
||||
},
|
||||
{
|
||||
name: "seal_simulation_feishu_approval_definitions_list",
|
||||
description: "列出飞书模拟测试可用的审批定义,便于选择 approvalCode",
|
||||
parameters: z.object({}),
|
||||
handler: async (client: KyInstance) => {
|
||||
const approvalDefinitions = await api.listFeishuSimulationApprovalDefinitions(client);
|
||||
return { count: approvalDefinitions.length, approvalDefinitions };
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "seal_llm_config_get",
|
||||
description: "查询当前 Seal 租户的大模型 (LLM) 配置",
|
||||
|
||||
@@ -336,6 +336,8 @@ export const InvoiceListDataSchema = z.object({
|
||||
feishuApprovalAppId: z.string().nullable().optional()
|
||||
}).passthrough();
|
||||
|
||||
export const SimulationApprovalDefinitionSchema = z.record(z.string(), z.unknown());
|
||||
|
||||
export const LlmConfigSchema = z.object({
|
||||
provider: z.string(),
|
||||
config: z.record(z.string(), z.unknown()).default({})
|
||||
@@ -594,6 +596,7 @@ export type SealContactsLastSyncTime = z.infer<typeof SealContactsLastSyncTimeSc
|
||||
export type InsightStats = z.infer<typeof InsightStatsSchema>;
|
||||
export type ExpenseListData = z.infer<typeof ExpenseListDataSchema>;
|
||||
export type InvoiceListData = z.infer<typeof InvoiceListDataSchema>;
|
||||
export type SimulationApprovalDefinition = z.infer<typeof SimulationApprovalDefinitionSchema>;
|
||||
export type LlmConfig = z.infer<typeof LlmConfigSchema>;
|
||||
export type LlmProvider = z.infer<typeof LlmProviderSchema>;
|
||||
export type AvailablePermissionsData = z.infer<typeof AvailablePermissionsDataSchema>;
|
||||
|
||||
Reference in new issue
Block a user