Group core utility modules into util, skill, and update
Move duration, redact, runtime, secure-file, and semver under core/util; embedded-skill and skill-version under core/skill; update-cache under core/update. Move the dev-override test next to the script it covers, and update the embedded-skill generator output path and regenerated manifest. No behavior change.
This commit is contained in:
1 parent
666a12c676
commit
a189f49223
44 files changed
+146
-145
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { writeSecureFile } from "../secure-file.js";
|
||||
import { writeSecureFile } from "../util/secure-file.js";
|
||||
import { SEAL_CONFIG_DIR } from "../paths.js";
|
||||
import {
|
||||
CorpTokenCache,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { CorpConfig, CorpConfigSchema, GlobalConfig, GlobalConfigInput, GlobalConfigSchema } from "./types.js";
|
||||
|
||||
import { writeSecureFile } from "../secure-file.js";
|
||||
import { writeSecureFile } from "../util/secure-file.js";
|
||||
|
||||
const CONFIG_ENV = "SEAL_USE_ENTERPRISES_DIR";
|
||||
const LEGACY_CONFIG_ENV = "SEAL_HOME_ENTERPRISES_DIR";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { writeSecureFile } from "../secure-file.js";
|
||||
import { writeSecureFile } from "../util/secure-file.js";
|
||||
import { join } from "node:path";
|
||||
import { resolveWritableEnterprisesDir } from "./loader.js";
|
||||
import { CorpConfigSchema, type CorpConfig } from "./types.js";
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { chmodSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { resolveTargetBinaryPath } from "../../scripts/dev-override.js";
|
||||
|
||||
describe("development CLI install target", () => {
|
||||
test("npm-linked source is never selected as the binary replacement target", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-dev-target-test-"));
|
||||
const originalPath = process.env.PATH;
|
||||
try {
|
||||
const command = join(dir, "seal-use");
|
||||
const source = join(dir, "cli.ts");
|
||||
writeFileSync(source, "#!/usr/bin/env bun\nconsole.log('source fixture')\n");
|
||||
chmodSync(source, 0o755);
|
||||
symlinkSync(source, command);
|
||||
process.env.PATH = `${dir}${process.platform === "win32" ? ";" : ":"}${originalPath ?? ""}`;
|
||||
expect(resolveTargetBinaryPath()).toBe(command);
|
||||
expect(readFileSync(source, "utf8")).toContain("source fixture");
|
||||
} finally {
|
||||
if (originalPath === undefined) delete process.env.PATH; else process.env.PATH = originalPath;
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("native command symlinks continue to replace the installed target", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-dev-target-test-"));
|
||||
const originalPath = process.env.PATH;
|
||||
try {
|
||||
const command = join(dir, "seal-use");
|
||||
mkdirSync(join(dir, "formula"));
|
||||
const target = join(dir, "formula", "seal-use");
|
||||
writeFileSync(target, "native binary fixture");
|
||||
chmodSync(target, 0o755);
|
||||
symlinkSync(target, command);
|
||||
process.env.PATH = `${dir}${process.platform === "win32" ? ";" : ":"}${originalPath ?? ""}`;
|
||||
expect(resolveTargetBinaryPath()).toBe(realpathSync(target));
|
||||
} finally {
|
||||
if (originalPath === undefined) delete process.env.PATH; else process.env.PATH = originalPath;
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -5,7 +5,7 @@ import { PRIMARY_LINTERS_DIR, OFFICIAL_LINTERS_DIR } from "../paths.js";
|
||||
import { VERSION } from "../../version.js";
|
||||
import { getLastCorpConfigLoadIssues, getLastGlobalConfigIssue, loadCorpConfigs, loadGlobalConfig } from "../config/loader.js";
|
||||
import { formatBeijingIso } from "../config/timestamps.js";
|
||||
import { getDefaultGlobalSkillDir, getSkillVersionStatus } from "../skill-version.js";
|
||||
import { getDefaultGlobalSkillDir, getSkillVersionStatus } from "../skill/skill-version.js";
|
||||
import { resolveUsageFilePath } from "../stats/usage-tracker.js";
|
||||
import {
|
||||
EMBEDDED_DIRECTORY_SPECS,
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
// Generated by scripts/generate-embedded-skill.mjs. Do not edit manually.
|
||||
|
||||
import file0 from "../../skills/seal-use/SKILL.md" with { type: "text" };
|
||||
import file1 from "../../skills/seal-use/agents/openai.yaml" with { type: "text" };
|
||||
import file2 from "../../skills/seal-use/assets/hose-curl-copy-as-curl.png" with { type: "file" };
|
||||
import file3 from "../../skills/seal-use/assets/hose-curl-network-fetch-xhr.png" with { type: "file" };
|
||||
import file4 from "../../skills/seal-use/assets/hose-curl-open-page-check.png" with { type: "file" };
|
||||
import file5 from "../../skills/seal-use/assets/hose-open-platform-app-center.png" with { type: "file" };
|
||||
import file6 from "../../skills/seal-use/assets/hose-open-platform-credentials.png" with { type: "file" };
|
||||
import file7 from "../../skills/seal-use/assets/hose-open-platform-product-config.png" with { type: "file" };
|
||||
import file8 from "../../skills/seal-use/references/approval-attachment-trace.md" with { type: "text" };
|
||||
import file9 from "../../skills/seal-use/references/approval-bad-cases.md" with { type: "text" };
|
||||
import file10 from "../../skills/seal-use/references/approval-run-export.md" with { type: "text" };
|
||||
import file11 from "../../skills/seal-use/references/approval-run-lightweight.md" with { type: "text" };
|
||||
import file12 from "../../skills/seal-use/references/cli.md" with { type: "text" };
|
||||
import file13 from "../../skills/seal-use/references/customer-feedback-rule-remediation.md" with { type: "text" };
|
||||
import file14 from "../../skills/seal-use/references/documents.md" with { type: "text" };
|
||||
import file15 from "../../skills/seal-use/references/enterprise-onboarding.md" with { type: "text" };
|
||||
import file16 from "../../skills/seal-use/references/expense-data.md" with { type: "text" };
|
||||
import file17 from "../../skills/seal-use/references/first-time-user.md" with { type: "text" };
|
||||
import file18 from "../../skills/seal-use/references/hose-enterprise-auth.md" with { type: "text" };
|
||||
import file19 from "../../skills/seal-use/references/hose-enterprise-deploy.md" with { type: "text" };
|
||||
import file20 from "../../skills/seal-use/references/hose-enterprise-init.md" with { type: "text" };
|
||||
import file21 from "../../skills/seal-use/references/langfuse-trace.md" with { type: "text" };
|
||||
import file22 from "../../skills/seal-use/references/report-templates.md" with { type: "text" };
|
||||
import file23 from "../../skills/seal-use/references/rule-lightweight.md" with { type: "text" };
|
||||
import file24 from "../../skills/seal-use/references/rule-lint.md" with { type: "text" };
|
||||
import file25 from "../../skills/seal-use/references/sealai-browser-rum.md" with { type: "text" };
|
||||
import file26 from "../../skills/seal-use/references/staging-simulation-workflow.md" with { type: "text" };
|
||||
import file27 from "../../skills/seal-use/references/tenant-status.md" with { type: "text" };
|
||||
import file28 from "../../skills/seal-use/references/webhook-resource-pack.md" with { type: "text" };
|
||||
|
||||
export const EMBEDDED_SKILL_TEXT_FILES: Record<string, string> = {
|
||||
"SKILL.md": file0,
|
||||
"agents/openai.yaml": file1,
|
||||
"references/approval-attachment-trace.md": file8,
|
||||
"references/approval-bad-cases.md": file9,
|
||||
"references/approval-run-export.md": file10,
|
||||
"references/approval-run-lightweight.md": file11,
|
||||
"references/cli.md": file12,
|
||||
"references/customer-feedback-rule-remediation.md": file13,
|
||||
"references/documents.md": file14,
|
||||
"references/enterprise-onboarding.md": file15,
|
||||
"references/expense-data.md": file16,
|
||||
"references/first-time-user.md": file17,
|
||||
"references/hose-enterprise-auth.md": file18,
|
||||
"references/hose-enterprise-deploy.md": file19,
|
||||
"references/hose-enterprise-init.md": file20,
|
||||
"references/langfuse-trace.md": file21,
|
||||
"references/report-templates.md": file22,
|
||||
"references/rule-lightweight.md": file23,
|
||||
"references/rule-lint.md": file24,
|
||||
"references/sealai-browser-rum.md": file25,
|
||||
"references/staging-simulation-workflow.md": file26,
|
||||
"references/tenant-status.md": file27,
|
||||
"references/webhook-resource-pack.md": file28,
|
||||
};
|
||||
|
||||
export const EMBEDDED_SKILL_ASSET_PATHS: Record<string, string> = {
|
||||
"assets/hose-curl-copy-as-curl.png": file2,
|
||||
"assets/hose-curl-network-fetch-xhr.png": file3,
|
||||
"assets/hose-curl-open-page-check.png": file4,
|
||||
"assets/hose-open-platform-app-center.png": file5,
|
||||
"assets/hose-open-platform-credentials.png": file6,
|
||||
"assets/hose-open-platform-product-config.png": file7,
|
||||
};
|
||||
|
||||
export const EMBEDDED_SKILL_ALL_PATHS = [
|
||||
"SKILL.md",
|
||||
"agents/openai.yaml",
|
||||
"assets/hose-curl-copy-as-curl.png",
|
||||
"assets/hose-curl-network-fetch-xhr.png",
|
||||
"assets/hose-curl-open-page-check.png",
|
||||
"assets/hose-open-platform-app-center.png",
|
||||
"assets/hose-open-platform-credentials.png",
|
||||
"assets/hose-open-platform-product-config.png",
|
||||
"references/approval-attachment-trace.md",
|
||||
"references/approval-bad-cases.md",
|
||||
"references/approval-run-export.md",
|
||||
"references/approval-run-lightweight.md",
|
||||
"references/cli.md",
|
||||
"references/customer-feedback-rule-remediation.md",
|
||||
"references/documents.md",
|
||||
"references/enterprise-onboarding.md",
|
||||
"references/expense-data.md",
|
||||
"references/first-time-user.md",
|
||||
"references/hose-enterprise-auth.md",
|
||||
"references/hose-enterprise-deploy.md",
|
||||
"references/hose-enterprise-init.md",
|
||||
"references/langfuse-trace.md",
|
||||
"references/report-templates.md",
|
||||
"references/rule-lightweight.md",
|
||||
"references/rule-lint.md",
|
||||
"references/sealai-browser-rum.md",
|
||||
"references/staging-simulation-workflow.md",
|
||||
"references/tenant-status.md",
|
||||
"references/webhook-resource-pack.md",
|
||||
];
|
||||
@@ -0,0 +1,98 @@
|
||||
// Generated by scripts/generate-embedded-skill.mjs. Do not edit manually.
|
||||
|
||||
import file0 from "../../../skills/seal-use/SKILL.md" with { type: "text" };
|
||||
import file1 from "../../../skills/seal-use/agents/openai.yaml" with { type: "text" };
|
||||
import file2 from "../../../skills/seal-use/assets/hose-curl-copy-as-curl.png" with { type: "file" };
|
||||
import file3 from "../../../skills/seal-use/assets/hose-curl-network-fetch-xhr.png" with { type: "file" };
|
||||
import file4 from "../../../skills/seal-use/assets/hose-curl-open-page-check.png" with { type: "file" };
|
||||
import file5 from "../../../skills/seal-use/assets/hose-open-platform-app-center.png" with { type: "file" };
|
||||
import file6 from "../../../skills/seal-use/assets/hose-open-platform-credentials.png" with { type: "file" };
|
||||
import file7 from "../../../skills/seal-use/assets/hose-open-platform-product-config.png" with { type: "file" };
|
||||
import file8 from "../../../skills/seal-use/references/approval-attachment-trace.md" with { type: "text" };
|
||||
import file9 from "../../../skills/seal-use/references/approval-bad-cases.md" with { type: "text" };
|
||||
import file10 from "../../../skills/seal-use/references/approval-run-export.md" with { type: "text" };
|
||||
import file11 from "../../../skills/seal-use/references/approval-run-lightweight.md" with { type: "text" };
|
||||
import file12 from "../../../skills/seal-use/references/cli.md" with { type: "text" };
|
||||
import file13 from "../../../skills/seal-use/references/customer-feedback-rule-remediation.md" with { type: "text" };
|
||||
import file14 from "../../../skills/seal-use/references/documents.md" with { type: "text" };
|
||||
import file15 from "../../../skills/seal-use/references/enterprise-onboarding.md" with { type: "text" };
|
||||
import file16 from "../../../skills/seal-use/references/expense-data.md" with { type: "text" };
|
||||
import file17 from "../../../skills/seal-use/references/first-time-user.md" with { type: "text" };
|
||||
import file18 from "../../../skills/seal-use/references/hose-enterprise-auth.md" with { type: "text" };
|
||||
import file19 from "../../../skills/seal-use/references/hose-enterprise-deploy.md" with { type: "text" };
|
||||
import file20 from "../../../skills/seal-use/references/hose-enterprise-init.md" with { type: "text" };
|
||||
import file21 from "../../../skills/seal-use/references/langfuse-trace.md" with { type: "text" };
|
||||
import file22 from "../../../skills/seal-use/references/report-templates.md" with { type: "text" };
|
||||
import file23 from "../../../skills/seal-use/references/rule-lightweight.md" with { type: "text" };
|
||||
import file24 from "../../../skills/seal-use/references/rule-lint.md" with { type: "text" };
|
||||
import file25 from "../../../skills/seal-use/references/sealai-browser-rum.md" with { type: "text" };
|
||||
import file26 from "../../../skills/seal-use/references/staging-simulation-workflow.md" with { type: "text" };
|
||||
import file27 from "../../../skills/seal-use/references/tenant-status.md" with { type: "text" };
|
||||
import file28 from "../../../skills/seal-use/references/webhook-resource-pack.md" with { type: "text" };
|
||||
|
||||
export const EMBEDDED_SKILL_TEXT_FILES: Record<string, string> = {
|
||||
"SKILL.md": file0,
|
||||
"agents/openai.yaml": file1,
|
||||
"references/approval-attachment-trace.md": file8,
|
||||
"references/approval-bad-cases.md": file9,
|
||||
"references/approval-run-export.md": file10,
|
||||
"references/approval-run-lightweight.md": file11,
|
||||
"references/cli.md": file12,
|
||||
"references/customer-feedback-rule-remediation.md": file13,
|
||||
"references/documents.md": file14,
|
||||
"references/enterprise-onboarding.md": file15,
|
||||
"references/expense-data.md": file16,
|
||||
"references/first-time-user.md": file17,
|
||||
"references/hose-enterprise-auth.md": file18,
|
||||
"references/hose-enterprise-deploy.md": file19,
|
||||
"references/hose-enterprise-init.md": file20,
|
||||
"references/langfuse-trace.md": file21,
|
||||
"references/report-templates.md": file22,
|
||||
"references/rule-lightweight.md": file23,
|
||||
"references/rule-lint.md": file24,
|
||||
"references/sealai-browser-rum.md": file25,
|
||||
"references/staging-simulation-workflow.md": file26,
|
||||
"references/tenant-status.md": file27,
|
||||
"references/webhook-resource-pack.md": file28,
|
||||
};
|
||||
|
||||
export const EMBEDDED_SKILL_ASSET_PATHS: Record<string, string> = {
|
||||
"assets/hose-curl-copy-as-curl.png": file2,
|
||||
"assets/hose-curl-network-fetch-xhr.png": file3,
|
||||
"assets/hose-curl-open-page-check.png": file4,
|
||||
"assets/hose-open-platform-app-center.png": file5,
|
||||
"assets/hose-open-platform-credentials.png": file6,
|
||||
"assets/hose-open-platform-product-config.png": file7,
|
||||
};
|
||||
|
||||
export const EMBEDDED_SKILL_ALL_PATHS = [
|
||||
"SKILL.md",
|
||||
"agents/openai.yaml",
|
||||
"assets/hose-curl-copy-as-curl.png",
|
||||
"assets/hose-curl-network-fetch-xhr.png",
|
||||
"assets/hose-curl-open-page-check.png",
|
||||
"assets/hose-open-platform-app-center.png",
|
||||
"assets/hose-open-platform-credentials.png",
|
||||
"assets/hose-open-platform-product-config.png",
|
||||
"references/approval-attachment-trace.md",
|
||||
"references/approval-bad-cases.md",
|
||||
"references/approval-run-export.md",
|
||||
"references/approval-run-lightweight.md",
|
||||
"references/cli.md",
|
||||
"references/customer-feedback-rule-remediation.md",
|
||||
"references/documents.md",
|
||||
"references/enterprise-onboarding.md",
|
||||
"references/expense-data.md",
|
||||
"references/first-time-user.md",
|
||||
"references/hose-enterprise-auth.md",
|
||||
"references/hose-enterprise-deploy.md",
|
||||
"references/hose-enterprise-init.md",
|
||||
"references/langfuse-trace.md",
|
||||
"references/report-templates.md",
|
||||
"references/rule-lightweight.md",
|
||||
"references/rule-lint.md",
|
||||
"references/sealai-browser-rum.md",
|
||||
"references/staging-simulation-workflow.md",
|
||||
"references/tenant-status.md",
|
||||
"references/webhook-resource-pack.md",
|
||||
];
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
import packageJson from "../../../package.json" with { type: "json" };
|
||||
import {
|
||||
EMBEDDED_SKILL_ALL_PATHS,
|
||||
EMBEDDED_SKILL_ASSETS,
|
||||
@@ -39,7 +39,7 @@ describe("embedded-skill", () => {
|
||||
expect(existsSync(join(tmp, "assets", "hose-curl-copy-as-curl.png"))).toBe(true);
|
||||
expect([...res.files].sort()).toEqual([...EMBEDDED_SKILL_ALL_PATHS].sort());
|
||||
for (const path of EMBEDDED_SKILL_ALL_PATHS) {
|
||||
expect(readFileSync(join(tmp, path))).toEqual(readFileSync(join(import.meta.dir, "../../skills/seal-use", path)));
|
||||
expect(readFileSync(join(tmp, path))).toEqual(readFileSync(join(import.meta.dir, "../../../skills/seal-use", path)));
|
||||
}
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
@@ -102,4 +102,4 @@ export function syncGlobalSkillIfPresent(): { synced: boolean; targetDir?: strin
|
||||
}
|
||||
|
||||
// Re-export agent host skill bridging capabilities
|
||||
export * from "./agent-hosts/index.js";
|
||||
export * from "../agent-hosts/index.js";
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
import { existsSync, readFileSync } from "node:fs"
|
||||
import { homedir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { compareSemVer } from "./semver.js"
|
||||
import { compareSemVer } from "../util/semver.js"
|
||||
|
||||
export const GLOBAL_SKILL_DIR_ENV = "SEAL_USE_GLOBAL_SKILL_DIR"
|
||||
|
||||
File renamed without changes.
@@ -1,10 +1,10 @@
|
||||
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
import type { LauncherConfig } from "./runtime.js";
|
||||
import { formatBeijingIso, normalizeBeijingIso } from "./config/timestamps.js";
|
||||
import type { LauncherConfig } from "../util/runtime.js";
|
||||
import { formatBeijingIso, normalizeBeijingIso } from "../config/timestamps.js";
|
||||
|
||||
import { SEAL_CACHE_DIR } from "./paths.js";
|
||||
import { SEAL_CACHE_DIR } from "../paths.js";
|
||||
|
||||
export const UPDATE_CACHE_FILE_ENV = "SEAL_USE_UPDATE_CACHE_FILE";
|
||||
export const DEFAULT_UPDATE_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -77,7 +77,7 @@ export async function performRuntimeSelfHealing(): Promise<{
|
||||
const legacySkillDir = join(homedir(), ".agents", "skills", "seal-home");
|
||||
if (existsSync(legacySkillDir)) {
|
||||
// Ordinary discovery must not initialize the embedded resource graph.
|
||||
(await import("./embedded-skill.js")).syncGlobalSkillIfPresent();
|
||||
(await import("../skill/embedded-skill.js")).syncGlobalSkillIfPresent();
|
||||
result.skillHealed = true;
|
||||
}
|
||||
} catch {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user