Enable strict unused-symbol checks and remove dead code
Turn on noUnusedLocals/noUnusedParameters so the compiler keeps flagging dead symbols, then clear the 737 findings it reports: unused imports across src/, unused parameters, unreachable locals, and the copy-pasted 135-line import prologues in the seal tool modules (each tool file now imports only what it uses). Also applies the equivalent-safe lint rewrites (Array.from instead of new Array(n).fill, non-null assertions in tests after toBeDefined, simplified spreads, unused catch params) that oxlint will gate in a later commit.
This commit is contained in:
1 parent
661babd4f4
commit
5f4906758e
43 files changed
+55
-1150
No files matched your search
@@ -335,30 +335,30 @@ describe("corps sync-test", () => {
|
||||
|
||||
const postPref = requests.find((r) => (r.method === "POST" || r.method === "PATCH") && r.path.includes("config"));
|
||||
expect(postPref).toBeDefined();
|
||||
expect((postPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
|
||||
expect((postPref!.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
|
||||
|
||||
const deleteDoc = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/knowledge/articles/test-doc-old");
|
||||
expect(deleteDoc).toBeDefined();
|
||||
|
||||
const patchDoc = requests.find((r) => r.method === "PATCH" && r.path === "/api/v1/knowledge/articles/test-doc-2");
|
||||
expect(patchDoc).toBeDefined();
|
||||
expect((patchDoc?.body as any).attributes?.content).toBe("Content Beta Updated");
|
||||
expect((patchDoc!.body as any).attributes?.content).toBe("Content Beta Updated");
|
||||
|
||||
const postDoc = requests.find((r) => r.method === "POST" && r.path === "/api/v1/knowledge/articles");
|
||||
expect(postDoc).toBeDefined();
|
||||
expect((postDoc?.body as any).title).toBe("Doc Alpha");
|
||||
expect((postDoc!.body as any).title).toBe("Doc Alpha");
|
||||
|
||||
const deleteRule = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/rules/test-rule-old");
|
||||
expect(deleteRule).toBeDefined();
|
||||
|
||||
const createdRules = requests.filter((r) => r.method === "POST" && r.path === "/api/v1/rules");
|
||||
expect(createdRules.length).toBe(2);
|
||||
expect((createdRules[0]?.body as any).description).toBe("Production Rule A");
|
||||
expect((createdRules[1]?.body as any).description).toBe("Production Rule B");
|
||||
expect((createdRules[0]!.body as any).description).toBe("Production Rule A");
|
||||
expect((createdRules[1]!.body as any).description).toBe("Production Rule B");
|
||||
|
||||
const publishVersion = requests.find((r) => r.method === "POST" && r.path === "/api/v1/rule-set-versions/publish");
|
||||
expect(publishVersion).toBeDefined();
|
||||
expect((publishVersion?.body as any).versionName).toBe("v1.5-staging");
|
||||
expect((publishVersion!.body as any).versionName).toBe("v1.5-staging");
|
||||
|
||||
const allPublishCalls = requests.filter((r) => r.path === "/api/v1/rule-set-versions/publish");
|
||||
expect(allPublishCalls.length).toBe(1);
|
||||
|
||||
@@ -694,7 +694,7 @@ describe("Hose OpenAPI key extraction from assistance link", () => {
|
||||
).toString("base64url");
|
||||
const fakeJwt = `header.${jwtPayload}.signature`;
|
||||
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
globalThis.fetch = (async (input: RequestInfo | URL) => {
|
||||
const urlStr = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
||||
const url = new URL(urlStr);
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ async function addLinkAsHoseCorp(link: string, name: string | undefined, overwri
|
||||
console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");
|
||||
let elevated;
|
||||
try {
|
||||
elevated = await elevateHoseLink({ link, name, overwrite, force, dryRun, ...(selection ?? {}) });
|
||||
elevated = await elevateHoseLink({ link, name, overwrite, force, dryRun, ...selection });
|
||||
} catch (error) {
|
||||
if (error instanceof HoseKeySelectionError) throw new CliError(error.message, 2, error.nextAction);
|
||||
throw error;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { sortCorpsByUsageAndRecency } from "../../../core/stats/usage-tracker.js
|
||||
import type { CorpEnvironment } from "../../../core/config/types.js";
|
||||
import { selectCorp } from "../../helpers.js";
|
||||
import { confirmationRequired, usageError } from "../../errors.js";
|
||||
import { booleanOption, numberOption, optionalString, stringOption } from "../../parser.js";
|
||||
import { booleanOption, numberOption, stringOption } from "../../parser.js";
|
||||
import { printJson } from "../../printer.js";
|
||||
import type { ParsedArgs } from "../../types.js";
|
||||
import { formatSafeSourceDetail, resolveCorpSealUrl } from "./shared.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createSealClient } from "../../../core/http/factory.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { syncTestEnterprise, buildTestHosecloudOutboundName } from "../../../domains/seal/test-sync.js";
|
||||
import { syncTestEnterprise } from "../../../domains/seal/test-sync.js";
|
||||
import { executeApprovalRunsReplay, type ReplayRecordsQuery } from "../../../domains/seal/webhook-replay.js";
|
||||
import { selectCorp } from "../../helpers.js";
|
||||
import { CliError, confirmationRequired, usageError } from "../../errors.js";
|
||||
|
||||
@@ -13,8 +13,6 @@ import type { CliRuntime } from "../types.js";
|
||||
|
||||
const DEFAULT_GITHUB_REPO = "yunyingk/seal-use";
|
||||
const LEGACY_GITHUB_REPO = "yunyingk/seal-home";
|
||||
const UPDATE_URL_ENV = "SEAL_USE_UPDATE_URL";
|
||||
const LEGACY_UPDATE_URL_ENV = "SEAL_HOME_UPDATE_URL";
|
||||
const GITHUB_REPO_ENV = "SEAL_USE_GITHUB_REPO";
|
||||
const LEGACY_GITHUB_REPO_ENV = "SEAL_HOME_GITHUB_REPO";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import {
|
||||
existsSync,
|
||||
lstatSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
@@ -14,7 +13,6 @@ import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
getAllAgentHostsStatus,
|
||||
getAllLinkableHostsStatus,
|
||||
getAntigravitySkillsStatus,
|
||||
getHostSkillsStatus,
|
||||
KNOWN_LINKABLE_HOSTS,
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
assertHoseAssistTenantMatches,
|
||||
defaultSealUrl,
|
||||
exchangeHoseAssistLink,
|
||||
fetchHoseOpenApiKeysFromLink,
|
||||
fetchHoseStaffDetails,
|
||||
getHoseEnterpriseUrl,
|
||||
getHoseProvisionalAuthLink,
|
||||
|
||||
@@ -79,6 +79,7 @@ export const SealHeaderMapSchema = z.record(
|
||||
|
||||
export const SealCookieMapSchema = z.record(
|
||||
z.string().regex(HTTP_TOKEN_PATTERN, "Invalid cookie name"),
|
||||
// oxlint-disable-next-line no-control-regex -- rejecting control chars IS the check.
|
||||
z.string().refine((value) => !/[\u0000-\u001f\u007f;]/.test(value), {
|
||||
message: "Cookie value cannot contain control characters or semicolons"
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@ export function formatCookieHeader(cookies: Record<string, string> | undefined):
|
||||
// same-named entry, while Authorization is always left to the caller so the
|
||||
// session bearer token can never be silently replaced by config.
|
||||
export function resolveSealCustomHeaders(seal: SealCustomHeaderSource | undefined): Record<string, string> {
|
||||
const headers: Record<string, string> = { ...(seal?.headers ?? {}) };
|
||||
const headers: Record<string, string> = { ...seal?.headers };
|
||||
const cookieHeader = formatCookieHeader(seal?.cookies);
|
||||
if (cookieHeader) headers.Cookie = cookieHeader;
|
||||
return headers;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { existsSync, symlinkSync, rmSync } from "node:fs";
|
||||
import { existsSync, symlinkSync } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import { basename, dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
filterCorpsFuzzy,
|
||||
fuzzyMatchString,
|
||||
levenshteinDistance,
|
||||
matchCorp,
|
||||
minSubstringLevenshtein,
|
||||
normalizeFuzzyPinyin
|
||||
} from "./fuzzy.js";
|
||||
|
||||
@@ -46,7 +46,7 @@ export function levenshteinDistance(a: string, b: string): number {
|
||||
if (n === 0) return m;
|
||||
|
||||
let prevRow = Array.from({ length: n + 1 }, (_, j) => j);
|
||||
let currRow = new Array<number>(n + 1).fill(0);
|
||||
let currRow: number[] = Array.from({ length: n + 1 }, () => 0);
|
||||
|
||||
for (let i = 1; i <= m; i += 1) {
|
||||
currRow[0] = i;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import {
|
||||
computeWindowCutoff,
|
||||
getRecentCorpUsageScores,
|
||||
loadUsageStats,
|
||||
pruneExpiredStats,
|
||||
recordCorpUsage,
|
||||
resolveUsageFilePath,
|
||||
sortCorpsByUsageAndRecency,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import type { KyInstance } from "ky";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
import {
|
||||
createHoseOpenClient,
|
||||
createHoseOpenClientWithCredentials,
|
||||
type HoseOpenClientCredentials
|
||||
createHoseOpenClient
|
||||
} from "./open/client.js";
|
||||
import {
|
||||
createHoseCloseClient,
|
||||
createHoseCloseClientWithCredentials,
|
||||
getHoseCloseHeaders,
|
||||
type HoseCloseClientCredentials
|
||||
|
||||
@@ -7,45 +7,26 @@ import {
|
||||
extractFlowPerson,
|
||||
isEbotOperator,
|
||||
formatOperator,
|
||||
parseHoseTimeline,
|
||||
parseHosePending,
|
||||
parseHoseOpenPending,
|
||||
calculateFlowMetrics,
|
||||
extractStaffOpinions,
|
||||
extractRejections,
|
||||
parseHoseFlow,
|
||||
parseHoseOpenComposite,
|
||||
getHoseFlow,
|
||||
getHoseOpenFlow,
|
||||
getHoseCloseFlow,
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
formatAiDecision,
|
||||
formatHumanOpinionLines,
|
||||
formatNumberedHumanOpinions,
|
||||
formatRejectionComment
|
||||
} from "./flow.js";
|
||||
import {
|
||||
searchCloseBacklogs,
|
||||
getCloseBacklogDetailById,
|
||||
resolveCloseBacklogId,
|
||||
fetchRawCloseHoseFlow,
|
||||
HOSE_CLOSE_LOOKUP_SELECT,
|
||||
HOSE_CLOSE_DETAIL_SELECT,
|
||||
HOSE_CLOSE_JOINS
|
||||
} from "./close/index.js";
|
||||
import {
|
||||
fetchHoseOpenFlowDetails,
|
||||
fetchHoseOpenAllLogs,
|
||||
fetchHoseOpenVersioned,
|
||||
fetchHoseOpenCompositeFlow
|
||||
} from "./open/index.js";
|
||||
import {
|
||||
createHoseClientWithCredentials,
|
||||
createHoseClient,
|
||||
createHoseOpenClient,
|
||||
createHoseCloseClient,
|
||||
getHoseHeaders,
|
||||
getHoseCloseHeaders
|
||||
getHoseHeaders
|
||||
} from "./client.js";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
fetchHoseOpenCompositeFlow,
|
||||
type HoseOpenAllLogsItem,
|
||||
type HoseOpenCompositeData,
|
||||
type HoseOpenFlowLog,
|
||||
type HoseOpenStaffItem,
|
||||
type HoseOpenVersionedItem
|
||||
} from "./open/index.js";
|
||||
|
||||
@@ -287,5 +287,5 @@ export async function onboardHoseWebSession(input: HoseWebSessionInput) {
|
||||
auth: { refreshTtl: 300 }
|
||||
};
|
||||
const saved = input.persist === false ? undefined : saveCorpConfig(config, { overwrite: input.overwrite });
|
||||
return { config, ...(saved ?? {}), session, identity, staffId };
|
||||
return { config, ...saved, session, identity, staffId };
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export async function fetchHoseOpenStaffs(
|
||||
.json();
|
||||
const parsed = HoseOpenStaffResponseSchema.parse(response);
|
||||
return parsed.items;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
if (options.conditionIds.length > 1) {
|
||||
const items: HoseOpenStaffItem[] = [];
|
||||
for (const id of options.conditionIds) {
|
||||
|
||||
@@ -387,7 +387,7 @@ describe("Seal Webhook API", () => {
|
||||
maxFileSizeBytes: 2000,
|
||||
allowedExtensions: [".pdf", ".xlsx"]
|
||||
});
|
||||
expect((posted?.integrations as Array<Record<string, unknown>>)[1]).toMatchObject({ type: "hosecloud" });
|
||||
expect((posted!.integrations as Array<Record<string, unknown>>)[1]).toMatchObject({ type: "hosecloud" });
|
||||
|
||||
const found = findWebhookIntegration([updated], "Renamed webhook");
|
||||
expect(found.id).toBe("integration-1");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import ky, { HTTPError, KyInstance } from "ky";
|
||||
import { HTTPError, KyInstance } from "ky";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
mergeMaterialPackFilePolicy,
|
||||
@@ -90,11 +90,7 @@ import {
|
||||
MaterialPackage,
|
||||
MaterialPackageSchema,
|
||||
SimulationSpecification,
|
||||
SimulationSpecificationSchema,
|
||||
ThinkingPolicy,
|
||||
ThinkingDepthPreference,
|
||||
HosecloudConfigInput,
|
||||
ApprovalRunsStats
|
||||
SimulationSpecificationSchema
|
||||
} from "./types.js";
|
||||
|
||||
const SuccessResponseSchema = z.object({ success: z.boolean().optional() }).passthrough();
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
formatExportDateTag,
|
||||
formatExportMinuteTag,
|
||||
getBeijingDate,
|
||||
getBeijingDateFrom,
|
||||
getRuleBriefTitle,
|
||||
normalizeManualApprovalStatus,
|
||||
normalizeTimestamp,
|
||||
@@ -212,7 +211,7 @@ describe("exportApprovalRunsToExcel integration", () => {
|
||||
|
||||
test("generates valid formatted excel workbook", async () => {
|
||||
const mockClient = {
|
||||
get: (url: string, opts?: any) => {
|
||||
get: (url: string) => {
|
||||
if (url.includes("api/v1/rules")) {
|
||||
return {
|
||||
json: async () => ({
|
||||
|
||||
@@ -826,7 +826,6 @@ export async function exportApprovalRunsToExcel(
|
||||
|
||||
// 6. 人工审核状态与驳回原因
|
||||
const mar = (record as any).manualApprovalRecord || {};
|
||||
const marSourceStatus = String(mar.status?.sourceStatus || "");
|
||||
let manualStatus = "-";
|
||||
if (mar.status?.label) {
|
||||
manualStatus = String(mar.status.label);
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { KyInstance } from "ky";
|
||||
import { formatBeijingIso } from "../../core/config/timestamps.js";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
import * as api from "./api.js";
|
||||
import { formatExportDateTag, getBeijingDate, resolveExportDateRange } from "./approval-runs-export.js";
|
||||
import { getBeijingDate, resolveExportDateRange } from "./approval-runs-export.js";
|
||||
import type { InsightPerformance } from "./types.js";
|
||||
|
||||
export interface InsightExportOptions {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { builtinRuleLinter } from "./builtin.js";
|
||||
import { loadRuleLinter } from "./loader.js";
|
||||
import { lintRuleBatch, lintSingleRule } from "./service.js";
|
||||
import { lintRuleBatch } from "./service.js";
|
||||
import { writeFileSync, unlinkSync, mkdirSync, existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
@@ -3,7 +3,6 @@ import type {
|
||||
RuleLintBatchResult,
|
||||
RuleLintContext,
|
||||
RuleLintItemResult,
|
||||
RuleLintResult,
|
||||
RuleLintTarget
|
||||
} from "./types.js";
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
isAttachmentColumn,
|
||||
attachmentLabel,
|
||||
attachmentKey,
|
||||
parsePaths,
|
||||
collectRowAttachments,
|
||||
parsePaths
|
||||
} from "./parse.js"
|
||||
import { buildAttachmentPlans } from "./attachments.js"
|
||||
import { MaterialPackValidationError } from "./types.js"
|
||||
|
||||
@@ -3,7 +3,7 @@ import { webhookHeaders } from "./signature.js"
|
||||
import { buildAttachmentPlans, injectAttachmentPlan } from "./attachments.js"
|
||||
import { parseMaterialWorkbook, type Parsed } from "./parse.js"
|
||||
import { extractZipEntry, readZipEntries, validatePackEntries, type ZipEntry } from "./validate.js"
|
||||
import { MaterialPackValidationError, type MaterialPackPreview, type MaterialPackPushResult, type ResourcePackPreview, type ResourcePackPushResult } from "./types.js"
|
||||
import { MaterialPackValidationError, type MaterialPackPreview, type MaterialPackPushResult } from "./types.js"
|
||||
import type { MaterialPackFilePolicyPatch } from "./policy.js"
|
||||
|
||||
function webhookInfo(url: string): { baseUrl: string; webhookId: string } {
|
||||
@@ -137,7 +137,7 @@ export async function pushMaterialPack(
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
...(config.customHeaders ?? {}),
|
||||
...config.customHeaders,
|
||||
...webhookHeaders({}, config.secret)
|
||||
},
|
||||
body
|
||||
@@ -157,7 +157,7 @@ export async function pushMaterialPack(
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
...(config.customHeaders ?? {}),
|
||||
...config.customHeaders,
|
||||
"Content-Type": "application/json",
|
||||
...webhookHeaders({ webhookId, ...document }, config.secret)
|
||||
},
|
||||
@@ -172,7 +172,7 @@ export async function pushMaterialPack(
|
||||
}
|
||||
|
||||
export function readMaterialPackFile(filePath: string): { fileBuffer: Buffer; fileName: string } {
|
||||
return { fileBuffer: readFileSync(filePath), fileName: filePath.split(/[\\\/]/).pop() ?? "material-pack.zip" }
|
||||
return { fileBuffer: readFileSync(filePath), fileName: filePath.split(/[\\/]/).pop() ?? "material-pack.zip" }
|
||||
}
|
||||
|
||||
export const previewResourcePack = previewMaterialPack
|
||||
|
||||
@@ -262,7 +262,7 @@ describe("regression service", () => {
|
||||
}
|
||||
} as any;
|
||||
|
||||
const mockFetch = async (url: string) => {
|
||||
const mockFetch = async () => {
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
|
||||
@@ -119,7 +119,7 @@ export async function syncTestEnterprise(
|
||||
});
|
||||
const changedRules = allSyncItems
|
||||
.filter((item) => !item.unchanged)
|
||||
.map(({ unchanged, ...rest }) => rest);
|
||||
.map(({ unchanged: _unchanged, ...rest }) => rest);
|
||||
const unchangedCount = allSyncItems.length - changedRules.length;
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,33 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import { ensureHoseCloseApiToken } from "../../../core/auth/hose.js";
|
||||
import { formatBeijingIso } from "../../../core/config/timestamps.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
@@ -35,103 +10,37 @@ import {
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
type ApprovalRun
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
ToolContext
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
localDateKey
|
||||
} = helpers;
|
||||
|
||||
export const approvalRunsTools = [
|
||||
|
||||
@@ -1,137 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
} = helpers;
|
||||
|
||||
export const billingTools = [
|
||||
{
|
||||
|
||||
@@ -1,137 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
} = helpers;
|
||||
|
||||
export const contactsTools = [
|
||||
{
|
||||
|
||||
@@ -1,136 +1,19 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import { probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
ToolContext
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
mutationPreview
|
||||
} = helpers;
|
||||
|
||||
export const deployTools = [
|
||||
|
||||
@@ -11,7 +11,6 @@ import type {
|
||||
WebhookIntegration
|
||||
} from "../types.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import type { LocalRuleItem } from "../rules-local.js";
|
||||
|
||||
export type ToolContext = {
|
||||
@@ -1541,4 +1540,3 @@ export function localParts(date: Date, timezone: string): Record<string, string>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,137 +1,10 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
} from "../types.js";
|
||||
import { createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
ToolContext
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
} = helpers;
|
||||
|
||||
export const identityTools = [
|
||||
{
|
||||
|
||||
@@ -1,137 +1,10 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
ToolContext
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
} = helpers;
|
||||
|
||||
export const insightTools = [
|
||||
{
|
||||
|
||||
@@ -1,136 +1,18 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
type DecisionPreferences
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
ToolContext
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
mutationPreview
|
||||
} = helpers;
|
||||
|
||||
export const preferenceTools = [
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import { formatBeijingIso } from "../../../core/config/timestamps.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { loadGlobalConfig } from "../../../core/config/loader.js";
|
||||
import { redactSensitiveText } from "../../../core/redact.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
@@ -23,118 +15,29 @@ import {
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
type RuleSetVersion
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
RuleField
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInDraft,
|
||||
findRuleInVersion,
|
||||
parseRuleCodeNumber,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
resolveRuleVersionSelector
|
||||
} = helpers;
|
||||
|
||||
export const rulesTools = [
|
||||
@@ -305,7 +208,7 @@ export const rulesTools = [
|
||||
resolvedRuleId = matched.id;
|
||||
}
|
||||
}
|
||||
const { ruleId, ...rest } = params;
|
||||
const { ruleId: _ruleId, ...rest } = params;
|
||||
const result = await api.updateApprovalRule(client, resolvedRuleId, rest);
|
||||
|
||||
if (params.description) {
|
||||
|
||||
@@ -1,138 +1,21 @@
|
||||
import { z } from "zod";
|
||||
import type { KyInstance } from "ky";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import * as api from "../api.js";
|
||||
import { defaultSealUrl, ensureHoseCloseApiToken, getHoseProvisionalAuthLink, probeHoseDomain } from "../../../core/auth/hose.js";
|
||||
import type { CorpConfig } from "../../../core/config/types.js";
|
||||
import { loadGlobalConfig, loadCorpConfigs, getEnterprisesDirCandidates } from "../../../core/config/loader.js";
|
||||
import { resolveCorpConfig } from "../../../core/config/manager.js";
|
||||
import { createSealClient, createSealClientForToken } from "../../../core/http/factory.js";
|
||||
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
|
||||
import { searchApprovalContent } from "../search.js";
|
||||
import { diffRuleVersions, normalizedRuleCode, truncateRuleDiff } from "../rule-diff.js";
|
||||
import { hydrateRuleVersionStableIds, savePublishedRuleVersionSnapshot } from "../rule-version-snapshot.js";
|
||||
import { executeApprovalRunsReplay, resolveReplayCorpPair } from "../webhook-replay.js";
|
||||
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "../linter/index.js";
|
||||
import {
|
||||
loadLocalRulesFile,
|
||||
saveLocalRulesFile,
|
||||
localRulesToLintTargets,
|
||||
type LocalRuleItem
|
||||
} from "../rules-local.js";
|
||||
import {
|
||||
checkWebhookReadiness,
|
||||
previewMaterialPack,
|
||||
pushMaterialPack,
|
||||
readMaterialPackFile
|
||||
} from "../material-pack/index.js";
|
||||
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "../material-pack/policy.js";
|
||||
import { extractApprovalRunAttachments } from "../attachments.js";
|
||||
import { exportApprovalRunsToExcel, normalizeTimestamp } from "../approval-runs-export.js";
|
||||
import {
|
||||
alignApprovalRunsWithHoseFlow,
|
||||
createHoseOpenClient,
|
||||
getHoseOpenFlow
|
||||
} from "../../hose/index.js";
|
||||
import { exportInsightReportToExcel, type InsightExportOptions } from "../insight-export.js";
|
||||
import {
|
||||
ThinkingPolicySchema,
|
||||
type ApprovalRule,
|
||||
type ApprovalRun,
|
||||
type RuleSetVersion,
|
||||
type SimulationBatch,
|
||||
type WebhookIntegration,
|
||||
type WebhookMode,
|
||||
type ThinkingPolicy,
|
||||
type DecisionPreferences,
|
||||
type HosecloudConfigInput
|
||||
type SimulationBatch
|
||||
} from "../types.js";
|
||||
import type {
|
||||
ToolContext,
|
||||
SealToolDefinition,
|
||||
ApprovalRunSummary,
|
||||
ApprovalRunsSummaryOptions,
|
||||
RuleField,
|
||||
RulePushPlan,
|
||||
SimulationBatchCreateInput,
|
||||
HumanResultMatch
|
||||
} from "./helpers.js";
|
||||
import * as helpers from "./helpers.js";
|
||||
|
||||
const {
|
||||
presentWebhookIntegration,
|
||||
getConfiguredSealBaseUrl,
|
||||
projectApprovalRules,
|
||||
pickRuleFields,
|
||||
buildRulePushPlan,
|
||||
rulesHaveSameContent,
|
||||
ruleChangedFields,
|
||||
normalizeRuleStrictness,
|
||||
parseDurationMs,
|
||||
redactIntegrationSecrets,
|
||||
mutationPreview,
|
||||
redactPreviewValue,
|
||||
buildSimulationBatchParams,
|
||||
summarizeSimulationBatch,
|
||||
summarizeApprovalRun,
|
||||
summarizeApprovalRuns,
|
||||
parseFieldPaths,
|
||||
pickRunFields,
|
||||
approvalRunMetadata,
|
||||
summarizeApprovalRunDetail,
|
||||
summarizeApprovalRunResult,
|
||||
summarizeApprovalRunDocument,
|
||||
extractCitedRules,
|
||||
findReusableSimulationBatch,
|
||||
firstPath,
|
||||
countPathCandidates,
|
||||
getPath,
|
||||
setPath,
|
||||
simulationBatchCreatedAtMs,
|
||||
compactObject,
|
||||
asRecord,
|
||||
numberFromUnknown,
|
||||
flattenDocumentFields,
|
||||
collectDocumentFields,
|
||||
firstByLabel,
|
||||
collectInvoiceSummary,
|
||||
collectInvoiceObjects,
|
||||
findKeywordLines,
|
||||
summarizeRunBridge,
|
||||
summarizeRuleVersion,
|
||||
resolveRuleVersionForLookup,
|
||||
findRuleInVersion,
|
||||
normalizeRuleCode,
|
||||
runtimeRuleIndex,
|
||||
runtimeRuleIdToCode,
|
||||
formatRuleCode,
|
||||
pickApprovalRunCandidate,
|
||||
resolveApprovalRunForUrl,
|
||||
resolveSealBaseUrl,
|
||||
normalizeUrl,
|
||||
stringFromUnknown,
|
||||
pickApprovalRuns,
|
||||
timestampOf,
|
||||
resolveRuleVersion,
|
||||
resolveRuleVersionSelector,
|
||||
filterRuns,
|
||||
scalarIncludes,
|
||||
objectContainsScalar,
|
||||
filterRunsByHumanResult,
|
||||
withApprovalRunFilters,
|
||||
resolveManualApprovalStatus,
|
||||
prepareApprovalRuns,
|
||||
approvalRunAliases,
|
||||
extractHumanResult,
|
||||
findHumanResultValue,
|
||||
isHumanResultKey,
|
||||
stringifyHumanResultValue,
|
||||
matchesRunLookup,
|
||||
countBy,
|
||||
localDateKey,
|
||||
formatLocalDateTime,
|
||||
toDate,
|
||||
localParts
|
||||
filterRuns
|
||||
} = helpers;
|
||||
|
||||
export const simulationTools = [
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import type { CorpConfig } from "../core/config/types.js";
|
||||
import { getOpenApiSchema } from "../core/embedded-openapi.js";
|
||||
import { loadCorpConfigs, loadGlobalConfig } from "../core/config/loader.js";
|
||||
import { createSealClient } from "../core/http/factory.js";
|
||||
import { findSealTool, sealTools, type SealTool } from "../domains/seal/tools.js";
|
||||
import { findSealTool, type SealTool } from "../domains/seal/tools.js";
|
||||
import { tokenizeCommand } from "../cli/tokenize.js";
|
||||
import { redactSensitiveText } from "../core/redact.js";
|
||||
import { VERSION } from "../version.js";
|
||||
|
||||
Reference in new issue
Block a user