Compare commits
3 Commits
main
...
fix/extens
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80facc5144 | ||
|
|
857cb27f13 | ||
|
|
e39e258d0c |
@ -1,6 +1,6 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import type { DirectoryConfigParams } from "openclaw/plugin-sdk/directory-runtime";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../../../src/config/config.js";
|
||||
import type { DirectoryConfigParams } from "../../../src/plugin-sdk/directory-runtime.js";
|
||||
import { listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive } from "./directory-live.js";
|
||||
|
||||
function makeParams(overrides: Partial<DirectoryConfigParams> = {}): DirectoryConfigParams {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { createNonExitingRuntime } from "openclaw/plugin-sdk/runtime-env";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/slack";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { slackOutbound } from "./outbound-adapter.js";
|
||||
@ -16,6 +17,8 @@ vi.mock("./runtime.js", () => ({
|
||||
|
||||
import { slackPlugin } from "./channel.js";
|
||||
|
||||
const runtime = createNonExitingRuntime();
|
||||
|
||||
async function getSlackConfiguredState(cfg: OpenClawConfig) {
|
||||
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
||||
return {
|
||||
@ -261,7 +264,7 @@ describe("slackPlugin directory", () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
runtime: undefined,
|
||||
runtime,
|
||||
}),
|
||||
).resolves.toEqual([{ id: "user:u123", kind: "user" }]);
|
||||
});
|
||||
|
||||
@ -94,6 +94,10 @@
|
||||
"types": "./dist/plugin-sdk/reply-runtime.d.ts",
|
||||
"default": "./dist/plugin-sdk/reply-runtime.js"
|
||||
},
|
||||
"./plugin-sdk/reply-payload": {
|
||||
"types": "./dist/plugin-sdk/reply-payload.d.ts",
|
||||
"default": "./dist/plugin-sdk/reply-payload.js"
|
||||
},
|
||||
"./plugin-sdk/channel-runtime": {
|
||||
"types": "./dist/plugin-sdk/channel-runtime.d.ts",
|
||||
"default": "./dist/plugin-sdk/channel-runtime.js"
|
||||
@ -394,6 +398,10 @@
|
||||
"types": "./dist/plugin-sdk/channel-policy.d.ts",
|
||||
"default": "./dist/plugin-sdk/channel-policy.js"
|
||||
},
|
||||
"./plugin-sdk/channel-send-result": {
|
||||
"types": "./dist/plugin-sdk/channel-send-result.d.ts",
|
||||
"default": "./dist/plugin-sdk/channel-send-result.js"
|
||||
},
|
||||
"./plugin-sdk/group-access": {
|
||||
"types": "./dist/plugin-sdk/group-access.d.ts",
|
||||
"default": "./dist/plugin-sdk/group-access.js"
|
||||
|
||||
@ -25,6 +25,30 @@ function normalizePath(filePath) {
|
||||
return path.relative(repoRoot, filePath).split(path.sep).join("/");
|
||||
}
|
||||
|
||||
function readDefaultTsconfigFiles() {
|
||||
const tsconfigPath = path.join(repoRoot, "tsconfig.json");
|
||||
const readTsConfigFile = (filePath) => ts.sys.readFile(filePath);
|
||||
const parsedConfig = ts.readConfigFile(tsconfigPath, readTsConfigFile);
|
||||
if (parsedConfig.error) {
|
||||
throw new Error(ts.flattenDiagnosticMessageText(parsedConfig.error.messageText, "\n"));
|
||||
}
|
||||
const resolvedConfig = ts.parseJsonConfigFileContent(
|
||||
parsedConfig.config,
|
||||
ts.sys,
|
||||
repoRoot,
|
||||
undefined,
|
||||
tsconfigPath,
|
||||
);
|
||||
if (resolvedConfig.errors.length > 0) {
|
||||
throw new Error(
|
||||
resolvedConfig.errors
|
||||
.map((error) => ts.flattenDiagnosticMessageText(error.messageText, "\n"))
|
||||
.join("\n"),
|
||||
);
|
||||
}
|
||||
return new Set(resolvedConfig.fileNames.map((fileName) => normalizePath(fileName)));
|
||||
}
|
||||
|
||||
function isCodeFile(fileName) {
|
||||
return /\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(fileName);
|
||||
}
|
||||
@ -337,8 +361,30 @@ function packageClusterMeta(relativePackagePath) {
|
||||
};
|
||||
}
|
||||
|
||||
function workspaceSourcePrefix(relativePackagePath) {
|
||||
if (relativePackagePath === "ui/package.json") {
|
||||
return "ui/";
|
||||
}
|
||||
const cluster = relativePackagePath.split("/")[1];
|
||||
return `extensions/${cluster}/`;
|
||||
}
|
||||
|
||||
function classifyMissingPackageCluster(params) {
|
||||
if (optionalBundledClusterSet.has(params.cluster)) {
|
||||
if (!params.defaultGraphReachable) {
|
||||
if (params.cluster === "ui") {
|
||||
return {
|
||||
decision: "optional",
|
||||
reason:
|
||||
"Private UI workspace is excluded from the default tsconfig graph, so repo-wide check/build does not require UI-only packages by default.",
|
||||
};
|
||||
}
|
||||
return {
|
||||
decision: "optional",
|
||||
reason:
|
||||
"Workspace package is excluded from the default tsconfig graph, so repo-wide check/build does not require its plugin-local dependencies by default.",
|
||||
};
|
||||
}
|
||||
if (params.cluster === "ui") {
|
||||
return {
|
||||
decision: "optional",
|
||||
@ -375,6 +421,7 @@ async function buildMissingPackages() {
|
||||
]);
|
||||
|
||||
const pluginSdkEntrySources = await walkCodeFiles(path.join(repoRoot, "src", "plugin-sdk"));
|
||||
const defaultTsconfigFiles = readDefaultTsconfigFiles();
|
||||
const pluginSdkReachability = new Map();
|
||||
for (const filePath of pluginSdkEntrySources) {
|
||||
const source = await fs.readFile(filePath, "utf8");
|
||||
@ -403,6 +450,9 @@ async function buildMissingPackages() {
|
||||
continue;
|
||||
}
|
||||
const meta = packageClusterMeta(relativePackagePath);
|
||||
const defaultGraphIncludedFileCount = [...defaultTsconfigFiles].filter((filePath) =>
|
||||
filePath.startsWith(workspaceSourcePrefix(relativePackagePath)),
|
||||
).length;
|
||||
const rootDependencyMirrorAllowlist = (
|
||||
pkg.openclaw?.releaseChecks?.rootDependencyMirrorAllowlist ?? []
|
||||
).toSorted(compareStrings);
|
||||
@ -411,12 +461,15 @@ async function buildMissingPackages() {
|
||||
);
|
||||
const classification = classifyMissingPackageCluster({
|
||||
cluster: meta.cluster,
|
||||
defaultGraphReachable: defaultGraphIncludedFileCount > 0,
|
||||
pluginSdkEntries,
|
||||
});
|
||||
output.push({
|
||||
cluster: meta.cluster,
|
||||
decision: classification.decision,
|
||||
decisionReason: classification.reason,
|
||||
defaultGraphIncludedFileCount,
|
||||
defaultGraphStatus: defaultGraphIncludedFileCount > 0 ? "included" : "excluded",
|
||||
packageName: pkg.name ?? meta.packageName,
|
||||
packagePath: relativePackagePath,
|
||||
npmSpec: pkg.openclaw?.install?.npmSpec ?? null,
|
||||
|
||||
@ -23,6 +23,21 @@
|
||||
"openclaw/plugin-sdk/account-id": ["./src/plugin-sdk/account-id.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "ui/**/*", "extensions/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"include": ["src/**/*", "extensions/**/*"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"ui",
|
||||
"extensions/acpx",
|
||||
"extensions/diagnostics-otel",
|
||||
"extensions/diffs",
|
||||
"extensions/googlechat",
|
||||
"extensions/matrix",
|
||||
"extensions/memory-lancedb",
|
||||
"extensions/msteams",
|
||||
"extensions/nostr",
|
||||
"extensions/tlon",
|
||||
"extensions/twitch",
|
||||
"extensions/zalouser"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user